Populating graph titles for multiple figures

9 ビュー (過去 30 日間)
Pw
Pw 2014 年 2 月 28 日
コメント済み: Pw 2014 年 3 月 3 日
Is there a way to populate the title in individual figures within a script? For example:
x = data_of_interest;
% Axial Load
figure(1)
plot((x(:,1)),(x(:,22:23)))
grid on
title('Rod ## Axial Load') % Put in the rod number plotting
xlabel('Serial Date')
ylabel('Rod Load [kips]')
% Average Displacement
figure(2)
plot((x(:,1)),(x(:,32)))
grid on
title('Rod ## Axial Displacement') % Put in the rod number plotting
xlabel('Serial Date')
ylabel('Average Displacement [in]')
....
I will have 11 individual figures per set of data. Within each dataset 'Rod ##' will be the same in each title (e.g., Rod 1, Rod 2, Rod 3, etc). I would like to find a way to set up something at the beginning of the script to populate this portion of the title so that I only have to change this item and the dataset being used. Is this possible?
Thank you.

採用された回答

Chad Greene
Chad Greene 2014 年 2 月 28 日
for n = 1:ll
figure(n)
% insert calculations and figure plotting here.
title(['Rod ',num2str(n),' Axial Displacement'])
end

その他の回答 (1 件)

Chad Greene
Chad Greene 2014 年 2 月 28 日
Or if you want subplots,
x = data_of_interest;
for n = 1:ll
figure(n)
% Axial Load
subplot(2,1,1)
plot((x(:,1)),(x(:,22:23)))
grid on
title(['Rod ',num2str(n),' Axial Load']) % Put in the rod number plotting
xlabel('Serial Date')
ylabel('Rod Load [kips]')
% Average Displacement
subplot(2,1,2)
plot((x(:,1)),(x(:,32)))
grid on
title(['Rod ',num2str(n),' Axial Displacement']) % Put in the rod number plotting
xlabel('Serial Date')
ylabel('Average Displacement [in]')
end
  1 件のコメント
Pw
Pw 2014 年 3 月 3 日
Great, thank you very much! This is going to make things so much quicker.

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by