For loop with running parameter out of struct
2 次查看(过去 30 天)
显示 更早的评论
Hello, I would like to run a for loop like this:
for Test.i=1:100 do something end
My intention is to have one struct where all my variables from my quite small script are stored and I don't mess up the workspace of the whole model.
Thanks in advance
0 个评论
回答(2 个)
madhan ravi
2018-10-24
编辑:madhan ravi
2018-10-24
for i=1:100
Test.x(i)=i ; %an example
Test.y(i)=x.^(i) ;
end
save('mymat.mat',Test)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!