How to automate the legend in GUI especially when use of for loop ?

1 回表示 (過去 30 日間)
Gopinath Karuppannan
Gopinath Karuppannan 2020 年 2 月 11 日
I have to automate the legend in for loop. When i try with below code, i couldn't able to automate the legend.
For information : X gets incremented everytime and also Y.
eval(['plot(X' num2str(i) ',Y' num2str(i), 'DisplayName','Gopi' ')']) -----> it is not working
  2 件のコメント
Rik
Rik 2020 年 2 月 11 日
Rethink your strategy of storing your data. If you need eval to access your variable something is going wrong. In case Stephen doesn't chime in: read this.
As for your problem: in a GUI you should always use an explicit parent object. Once you have made sure of that, this code should cause your legend to fill automatically, but only if it already exists. If adding the parent doesn't solve your question you should try to make a MWE so we can run your code without any other dependencies and can reproduce your issue.
Gopinath Karuppannan
Gopinath Karuppannan 2020 年 2 月 13 日
Thanks Rik. I have used the strategy of storing the data. It works fine for me. Thanks for your help

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

回答 (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