Function Save() and optimizzation
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello i want to optimize my code. i have these 3 matrix:
save H_scorr
save Hscorr_abs
save Hscorr_ang
in exit from a for() cicle, that are all 7x7. Does exist a way to save them in 1 file .mat? Next step is that these three matrix became 12 (4x3matrix all 7x7) and i need to save all of them. Actually the only idea i had to save them all is a simply:
if i==1
H_scorr=Hscorr;
H_scorr_abs=Hscorr_abs;
H_scorr_ang=Hscorr_ang;
save H_scorr
save Hscorr_abs
save Hscorr_ang
end
with the if that is repeated four times but of course i don't like this way....can you help me to optimize this part of my code?
the idea i've had is:
H_scorr(i)=Hscorr;
but i've got this error:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.
Error in ==> prova at 103 H_scorr(i)=Hscorr;
thank you
댓글 수: 2
Swarooph
2011년 11월 18일
Let me reiterate the question to see if I understand this correctly.
1. You want to know how to save 3 different variables in a single MAT file
2. Do you want to save all the 12 matrices separately so that finally your MAT file will have 12 matrices?
답변 (1개)
Image Analyst
2011년 11월 18일
It can be quite informative if you look up the help for functions. That way you'd see how what you want is there in black and white as an example:
save(yourFullMatFileName, 'H_scorr',...
'Hscorr_abs', 'Hscorr_ang');
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!