How to save each iteration in cell array?
显示 更早的评论
I am using for loop for each folders to save the value in each iteration. But, the problem is: it overrides the value and save only last iteration. How do I save each iteration in cell array for each folder in for loop?
回答(1 个)
madhan ravi
2018-10-24
编辑:madhan ravi
2018-10-24
c=cell(zeros(1,12))
for ii = 1:12. %edited after sir Image Analyst's comment
c{ii}= %do something;
end
7 个评论
Image Analyst
2018-10-24
To avoid problems when one might encounter complex numbers, it's usually advised to use "k" or "index" or "ii" or something for the loop iterator variable instead of i and j (the imaginary variables).
madhan ravi
2018-10-24
thank you sir Image Analyst couldn't get rid of this habit
sam moor
2018-10-24
madhan ravi
2018-10-25
Upload your code
sam moor
2018-10-25
sam moor
2018-10-29
per isakson
2018-10-29
Two thoughts
- Always provide the full error message. output is assigned values in many places
- See Debug a MATLAB Program and Examine Values While Debugging. It's tricky to spot the problem without being able to run the code.
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!