how to write a changing title in a loop

29 ビュー (過去 30 日間)
vishant m.
vishant m. 2013 年 11 月 16 日
回答済み: Azzi Abdelmalek 2013 年 11 月 16 日
function data=coa08xxx_lines(n)
data=load('xydata');
y=data.Y;
u=data.X;
ii=ceil(n/3);
jj=ceil(n/ii);
for k=1:n;
subplot(ii,jj,k)
plot(u(:,k),y(:,k));
for n=1:9
(title (n,'th col of X vs',n,'th col of Y'))
end
end
This is a silly code, but it is the best way to display m question. from this code when n=9 o get 9 subplots, i want each one to have a title wihe corresponding n.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 16 日
function data=coa08xxx_lines(n)
data=load('xydata');
data=load('xydata');
y=data.Y;
u=data.X;
ii=ceil(n/3);
jj=ceil(n/ii);
for k=1:n;
subplot(ii,jj,k)
plot(u(:,k),y(:,k));
title (sprintf('%dth col of X vs %dth col of Y',k,k))
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