How can I store nested for loop values to a cell array?
36 views (last 30 days)
Show older comments
I am using a nested for loop. Loop executed values are being stored in cell array but for the first row its working well but from the secong row the last cell value of first row is being repeated . how to solve this ?
1 Comment
Accepted Answer
Adam Danz
on 26 Feb 2019
Edited: Adam Danz
on 26 Feb 2019
Here's a general sketch of how to store data in a cell array within two nested for-loops. If there is something more specific you're looking for, please add some details.
myCell = cell(n,m);
for i = 1:n
for j = 1:m
myCell{i,j} = myFunction(data);
end
end
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!