How to check the variables are equal or not?

2 ビュー (過去 30 日間)
Athul C P
Athul C P 2018 年 6 月 25 日
回答済み: Stephen23 2018 年 6 月 25 日
if a=rt && b=rt
h=h+1;
elseif a~=rt && b=rt
f=f+1;
elseif a=rt && b~=rt
m=m+1;
elseif a~=rt && b~=rt
c=c+1;
end
Is this correct or I wanted to use double equal to '==' to check it

採用された回答

Stephen23
Stephen23 2018 年 6 月 25 日
You have to use
==
or
isequal
or
strcmp
or
ismember
or any other function that compares variables. = is only for allocation.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by