Coordinating axis title with variable

5 ビュー (過去 30 日間)
Faith McColl
Faith McColl 2015 年 6 月 17 日
コメント済み: Faith McColl 2015 年 6 月 22 日
I have a list of several variables to plot, each of which is a string of numbers. If I want to plot each on a separate graph, is there a way to code it so that when I plot "a" the label of the x-axis is automatically "a"? And is there a way to duplicate the pattern so I don't have to manually change the x-axis title for each graph? I tried using the "if" function, but that didn't work.

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 6 月 18 日
編集済み: Walter Roberson 2015 年 6 月 18 日
function myplot(variable)
f = figure();
ax = axes('Parent', f);
plot(ax, variable);
xlabel( inputname(1) );
end
after that,
myplot(a);
myplot(q37);
myplot(skidoo);
would produce plots with xlabel 'a', 'q37', and 'skidoo'
  1 件のコメント
Faith McColl
Faith McColl 2015 年 6 月 22 日
Matlab is telling me that "myplot" is not an operation that exists. Do I need to program something into it? I have Student Matlab 2015 if that helps.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by