Sorry for all of the code being jumbled up, I can't figure out how to change it.
How to plot mulitiple figures on the same page from a single For loop?
1 view (last 30 days)
Show older comments
I want to be able to plot 36 figures (consisting of 10 data points) on a single page from my for loop. I'd like to use the subplot code but I do not know how to give values to 'p' to which figure comes first. Here is the initial code:
lon = load('AVISO.lon.dat'); lat = load('AVISO.lat.dat');
sshmean = zeros(915,1080);
for i=1:36 istart=10*(i-1)+1 for day = istart:istart+9 disp(['Loading file for: ' int2str(day)]); filename = ['AVISO.ssh.2008.' int2str(day) '.dat']; ssh = load(filename); sshmean = sshmean+ssh'; sshmean = sshmean./10; figure; pcolor(lon,lat,sshmean); shading flat; caxis; colorbar; axis([20 120 -40 30]); end
3 Comments
Azzi Abdelmalek
on 8 Nov 2013
Edited: Azzi Abdelmalek
on 8 Nov 2013
Walter Roberson
on 8 Nov 2013
To check: at each step you are including effects from all old data, but dampening by a factor of 10 per step? Is that 10 related to the 10 data points? If so then it is not obvious why you would divide by 10 as you are not summing over the 10 days before you divide by 10.
Notice that you have two "for" loops but only one "end" statement.
Answers (0)
See Also
Categories
Find more on Subplots 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!