Put array in ListBox to choose different values for plot/ App Designer

8 ビュー (過去 30 日間)
Henry Tran
Henry Tran 2020 年 12 月 10 日
コメント済み: Mario Malic 2020 年 12 月 12 日
Hi,
I want to put all these values in the array G into my ListBox, but it doesn't show up.
My array "zR" has different sizes.
My purpose for the ListBox is to choose a number and show in my plot different lines. I am also open to other solutions besides the ListBox for my purpose.
Thank you in advance !
app.ListBox.Items=num2str(zR)
app.ListBox.ItemsData=num2str(zR)

回答 (1 件)

Mario Malic
Mario Malic 2020 年 12 月 10 日
Hello,
No need to assign ItemsData. Try this
app.ListBox.Items=num2str(zR(:))
  4 件のコメント
Henry Tran
Henry Tran 2020 年 12 月 12 日
It appears an error after entering your suggestion:
"Error using matlab.ui.control.internal.model.AbstractStateComponent/set.Items (line 184)
'Items' must be a 1-D cell array of character vectors or a string array."
I figured the solution for my problem:
app.ListBox.Items = num2cell(num2str(zR),2)
Anyway thank you for your help !
Mario Malic
Mario Malic 2020 年 12 月 12 日
Great that you've figured it out yourself!

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

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by