How do I split one column with 744 rows into 31 columns with 24 values.
1 view (last 30 days)
Show older comments
I have one column with 744 rows of random values, how do I use a for loop to create a different array of 31 columns for every 24 row (since 744/24 = 31).
2 Comments
James Tursa
on 14 Apr 2020
If you need to use a nested for-loop for homework, what have you done so far? What specific problems are you having with your code?
Accepted Answer
James Tursa
on 14 Apr 2020
A = your column vector
result = reshape(A,24,31);
2 Comments
Guillaume
on 14 Apr 2020
"is there a way to do this using a nested for loop?"
for i = 1 %pointless loop
for j = 1 %pointless nested loop
result = reshape(A,24,31);
end
end
Any other method, such as copying each element one at a time, is a complete waste of time and not the way to write code in matlab.
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!