For loop with running parameter out of struct

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

답변 (2개)

madhan ravi
madhan ravi 2018년 10월 24일
편집: madhan ravi 2018년 10월 24일

0 개 추천

for i=1:100
Test.x(i)=i ; %an example
Test.y(i)=x.^(i) ;
end
save('mymat.mat',Test)
KSSV
KSSV 2018년 10월 24일

0 개 추천

mystruct = struct ;
for i = 1:10
mystruct(i).value = rand ;
end

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2018년 10월 24일

편집:

2018년 10월 24일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by