필터 지우기
필터 지우기

Can I use the vector values as an expression in " If condition" ?

조회 수: 1 (최근 30일)
omar th
omar th 2022년 4월 15일
댓글: omar th 2022년 4월 15일
Can I use the vector values as an expression in " if "
% Distance as vector
D1 = [500 456 789 963 302 423 700 785];
[M, Indx] = find (D1 <500);
% after running the above code, let's say we will get
Indx = [2 5 6]
% Now Can use the values of index in if condition as expression
if Indx ==[2 5 6]
X = 20;
else
Z=50;
end

채택된 답변

David Hill
David Hill 2022년 4월 15일
if isequal(Indx,[2 5 6])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by