Matlab menu function not returning all options.

1 回表示 (過去 30 日間)
Jeffrey Smith
Jeffrey Smith 2019 年 2 月 7 日
回答済み: Jeffrey Smith 2019 年 2 月 7 日
I have a 11x5 matrix under the variable VCD2
The code I enter is as follows.
InFreq = menu('Select an input frequency [Hz].', VCD2(2:end, 1))
Instead of returning all the options the only choice available is the data in cell 2,1
Changing 2:end to 2:11 fixes nothing.
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 2 月 7 日
Could you confirm that VCD2(2:end,1) is a cell array of character vectors ?
Jeffrey Smith
Jeffrey Smith 2019 年 2 月 7 日
VCD2 was a matrix. I solved the problem by using num2cell(VCD2) to convert it into a cell array. From there I changed VCD2(2:end, 1) to VCD2{2:end, 1} after it became an array. Sorry for posting this then solving it myself lol. Thank you anyways! :D

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

採用された回答

Jeffrey Smith
Jeffrey Smith 2019 年 2 月 7 日
Sorry for answering my own question but I managed to figure it out.
When using the menu command, if it does return all options when provided a matrix change the matrix to a cell array.
Ex:
A = [1 2 3; 3 2 1]
A = num2cell(A)
B = menu('Example Text', A{:, 2})

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by