How to check the variables are equal or not?

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Entering Commands 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by