Store arrays produced by for loop
Show older comments
Hello,
I am writing a script that produces an array, vq, every iteration through a loop. I am trying to save each version of vq so I can compare each vq row by row later on. I suppose storing each vq as a column in a matrix would be ideal since each vq is the same length. This is my code:
for m=B1(1:end,:)
for n = B2(1:end,:)
for p=1:length(B1)
H=find(time_dec > m(p) & time_dec < n(p));
[Alt,index]=unique(Alt(H));
temp=Temp(H);
xq=30.5:17.5:2000;
vq=interp1(Alt,temp(index),xq)';
end
end
end
Any suggestions?
Thank you very much.
5 Comments
Stephen23
on 1 Jul 2019
What sizes are B1 and B2 ?
Olivia Booth-Howe
on 1 Jul 2019
Olivia Booth-Howe
on 1 Jul 2019
Jan
on 1 Jul 2019
"Doesn't work" is not useful to describe a problem.
This looks strange:
for m=B1(1:end,:)
"They are vectors of length 2, 3, 4, 5, or 6." - please post their size(). It matters, if they are row or column vectors.
Olivia Booth-Howe
on 1 Jul 2019
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!