Changing Plot Title from variable
11 ビュー (過去 30 日間)
古いコメントを表示
How would I change the title of figure based on the value in a cell?
For example: I have my angle, power reading, and exposure values in cells (219X1 doubles)
For each image I create, how can I make the title correspond to the values in the cells like this:
Image1 has title: Angle = angle(1), Power = power(1), Exposure = exposure(1)
Image2 has title: Angle = angle(2), Power = power(s), Exposure = exposure(2)
Additional notes: the images are created by using imagesc in a loop
0 件のコメント
採用された回答
Sean de Wolski
2011 年 7 月 18 日
for ii = 1:219
%plot stuff
title(sprintf('Angle = angle(%i), Power = power(%i), Exposure = exposure(%i)',ang(ii),pow(ii),exposure(ii)));
end
Don't call your variables angle and power since those are (useful) builtin MATLAB functions!
1 件のコメント
Jan
2011 年 7 月 18 日
@Matt: If this works for you, the values have *not* been stored in a "cell". Please read "help cell".
その他の回答 (1 件)
Jan
2011 年 7 月 18 日
for i = 1:219
% Create the image
title(sprintf('Angle = %f, Power = %f, Exposure = %f', ...
angle{i}, power{i}, exposure{i}));
end
Are you sure that the data are stored in a CELL? If you use DOUBLE arrays instead, you need round paremthesis instead of the curly braces.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!