Problem-saving the results from the loop
이전 댓글 표시
Hello. I need help
I have this code, I want to save the results from Sbar1.
Nn=4;
for i=1:1:Nn
for X1=0:45:360
c= cos(X1*pi/180)
s= sin(X1*pi/180)
R= [1 0 0; 0 1 0; 0 0 2]
A1= [c^2 s^2 2*s*c; s^2 c^2 -2*s*c; -s*c s*c c^2-s^2]
Sbar1= [R*A1^-1*R^-1*S*A1]
end
end
채택된 답변
추가 답변 (1개)
Aravind Ravikumar
2019년 6월 21일
0 개 추천
I'm assuming by save, you mean to write the data into an external file. Have a look at save() (documentation here).
With this, you can save workspace variables into a file and you can set various options like the file type, the variables, the format, etc.
댓글 수: 2
madhan ravi
2019년 6월 21일
편집: madhan ravi
2019년 6월 21일
No , the OP wants to save the results of each iteration into the variable.
Aravind Ravikumar
2019년 6월 21일
Ohh thinking now, I think that seems more sensible.
카테고리
도움말 센터 및 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!