Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
omar th
omar th am 15 Apr. 2022
Kommentiert: omar th am 15 Apr. 2022
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

Akzeptierte Antwort

David Hill
David Hill am 15 Apr. 2022
if isequal(Indx,[2 5 6])

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by