Function Save() and optimizzation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Swarooph
am 18 Nov. 2011
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?
Antworten (1)
Image Analyst
am 18 Nov. 2011
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');
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!