how to title the plots using for loop?

5 ビュー (過去 30 日間)
Lilya
Lilya 2018 年 12 月 5 日
コメント済み: Lilya 2018 年 12 月 6 日
Hi all,
I have a char array (attached) that i want to use it as a title in the for loop
any help would be appreciated.
Thanks a lot

採用された回答

KSSV
KSSV 2018 年 12 月 5 日
load('DAYS.mat') ;
for i = 1:length(DAY)
figure(i)
title(DAY(i,:)) ;
end
  2 件のコメント
Lilya
Lilya 2018 年 12 月 6 日
Thank you Sir KSSV. it works but the figures are not showing one by one. it shows only the last one with all different dates.
Any help?
Thanks
Lilya
Lilya 2018 年 12 月 6 日
Here what i used
for i=92:140;
filename=[files(i).name];
% disp(['Processing ', files(i).name]);
sst = ncread(filename,'sea_surface_temperature');
lon = ncread(filename,'lon');
lat = ncread(filename,'lat');
sst = sst';
idxlon = find(lon>lonmin & lon<lonmax);
goodlon = lon(idxlon);
idxlat = find(lat>latmin & lat<latmax);
goodlat = lat(idxlat);
subset_sst = sst(idxlat,idxlon);
% mn=nanmean(nanmean((subset_sst)));
% TEMP=[TEMP,mn];
y=files(i).name(1:4);
dd=files(i).name(7:8);
mm=files(i).name(5:6);
DT=strcat(dd,'/',mm,'/',y);
DAY=[DAY;DT];
figure
hold on
orient portrait;
m_pcolor(goodlon,goodlat,subset_sst-273.15)
shading interp
colormap(jet);
m_proj('mercator','lon',[lonmin lonmax],'lat',[latmin latmax]);
m_usercoast('red_sea_f','patch',[0.8 0.8 0.8]); % gray color
m_grid('contour','on','tickdir','out','box','fancy','fontsize',10,...
'linewidth',1,'linestyle','--');
m_plot(Xlon,Xlat,'.','Color','k')
ylabel('Latitude','fontsize',14,'fontweight','bold');
xlabel('Longitude','fontsize',14,'fontweight','bold');
caxis([21 30]);
% title(DAY(i,:)) ;
colorbar;
hold off
pause
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by