フィルターのクリア

if statement - working with characters

60 ビュー (過去 30 日間)
Ojaswita
Ojaswita 2013 年 9 月 23 日
コメント済み: Gwangil Mun 2022 年 11 月 26 日
I am executing the following code:
x = inputdlg({'Month', 'Population renewal', 'Death rate'}, 'Inputs')
f = getfield(x,{1});
if (f == 'January')
b = 0.5
else
b = 0.7
end
and I am getting an error that says "??? Undefined function or method 'eq' for input arguments of type 'cell'"
Please do tell me where I am going wrong....

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 23 日
Use
if isequal(f{1} ,'january')
  7 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 9 月 24 日
any(strcmp(f,{'janury','march'}))
Gwangil Mun
Gwangil Mun 2022 年 11 月 26 日
good

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by