How do I use a string for the argument in legend()?

12 ビュー (過去 30 日間)
Anthony Mittas
Anthony Mittas 2015 年 7 月 22 日
回答済み: Star Strider 2015 年 7 月 22 日
I have created this string: legend_string = ['g-Switch High', 'g-Switch Low']; I would like to use it like this: legend(legend_string) to plot 2 legend lines (blue line - g-Switch High, red line - g-Switch Low). What I get is one legend line with 'g-Switch High', 'g-Switch Low' as the display.

採用された回答

Star Strider
Star Strider 2015 年 7 月 22 日
The square brackets [] concatenate character arrays. Making a cell array out of them will display them as you want them:
legend_string = {'g-Switch High', 'g-Switch Low'};

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by