How do I use a string for the argument in legend()?
12 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!