필터 지우기
필터 지우기

Problem entering an if-sentence with a "~="-statement

조회 수: 2 (최근 30일)
Hans Jakob
Hans Jakob 2013년 12월 31일
편집: Wayne King 2013년 12월 31일
I have these two matrices.
RowAndColumn =
2 1
3 1
3 2
RowAndColumnCheck =
3 2
3 1
and i want to use the following if-sentence as an example for my problem:
if RowAndColumn(1,1:2) ~= RowAndColumnCheck(2,1:2)
blablabla
end
The problem seems to be the fact that RowAndColumn(1,2) and RowAndColumnCheck(2,2) is the same, and the function won't enter the if-sentence.
How can i fix this problem? I want to enter the sentence because [2,1] is not the same as [3,1] in total :)
Best Regard HJV

채택된 답변

Wayne King
Wayne King 2013년 12월 31일
편집: Wayne King 2013년 12월 31일
How about just using isequal()
if ~isequal(RowAndColumn(1,:),RowAndColumnCheck(2,:))
disp('blabla');
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by