フィルターのクリア

Undefined operator '>=' for input arguments of type 'cell'.

1 回表示 (過去 30 日間)
Jon Covert
Jon Covert 2020 年 2 月 16 日
コメント済み: Jon Covert 2020 年 2 月 16 日
x = inputdlg({'Pick a value between 0 and 1, and will try my best to guess a number greater than that! '},...
'Critical Number Guesser', [1 30]); % This line takes the user input and stores it as the variable x
if x >= 1
msgbox("Invalid Input", "Error", "error");
elseif x <= 0
msgbox("Invalid Input", "Error", "error");
I keep trying to run this code, but I keep getting this error message
"Undefined operator '>=' for input arguments of type 'cell'." Please Help!

採用された回答

Joseph Cheng
Joseph Cheng 2020 年 2 月 16 日
you can adust it to take out the cell using cell2mat() function or quick cell indexing using the curly brackets {} can do the trick. see below
x = inputdlg({'Pick a value between 0 and 1, and will try my best to guess a number greater than that! '},...
'Critical Number Guesser', [1 30]); % This line takes the user input and stores it as the variable x
if x{1} >= 1
msgbox("Invalid Input", "Error", "error");
elseif x{1} <= 0
msgbox("Invalid Input", "Error", "error");
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by