legend is not showing

11 ビュー (過去 30 日間)
sivalogan satchithanandamoorthy
sivalogan satchithanandamoorthy 2017 年 6 月 27 日
コメント済み: Walter Roberson 2017 年 6 月 27 日
for i=1:x %loop
figure(1)
hold on
plot(strain{i},stress{i});
legendInfo{i}=['Cycle',mat2str(cycle(i))]; %convert value to string
plot(Time{i},Value{i});
legendIn2{i}=['Simulink','DisplayName','numerical model',mat2str(cycle(i))];
hold all
end
legend(legendInfo,legendIn2)
for some reason only legendIn2 is being displayed in the plot. how to fix this? Any help would be much appricated.
siva

採用された回答

Walter Roberson
Walter Roberson 2017 年 6 月 27 日
legend([legendInfo; legendIn2])
  3 件のコメント
sivalogan satchithanandamoorthy
sivalogan satchithanandamoorthy 2017 年 6 月 27 日
there is a small problem. when legendInfo and legendIn2 have multiple graph, then error message appear.the error message is as fallows: Operands to the and && operators must be convertible to logical scalar values.
Error in legend (line 189) all(isgraphics(args{1})) % legend(children,strings,...)
Error in Cycle_stressStrain_test_model (line 67) legend([legendInfo; legendIn2]) %having multiple legend displayed
Walter Roberson
Walter Roberson 2017 年 6 月 27 日
legend(reshape([legendInfo; legendIn2],1,[]))

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

その他の回答 (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