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 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