フィルターのクリア

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

7 ビュー (過去 30 日間)
Ali Tawfik
Ali Tawfik 2020 年 4 月 29 日
回答済み: David Hill 2020 年 4 月 29 日
Hi all,
I using MatLab 2016a and I am trying to create if loop however, always get the following error "Undefined operator '==' for input arguments of type 'cell'.
I undersand its cell array not character but even if i change p to character still not working... hope anyone can help me... I just would like to do a statement if p='yes' and another if something else and so on...
clear all;
clc;
p={'yes' ,'no'};
for i=1:2
if p(i)=='yes'
z(i)=1500+(3/4)
else
display('wrong')
end
end

採用された回答

David Hill
David Hill 2020 年 4 月 29 日
p={'yes' ,'no'};
for i=1:2
if isequal(p{i},'yes')%need {} instead of (), use isequal()
z(i)=1500+(3/4)
else
display('wrong')
end
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by