"if condition not worked"
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
% V,Ma,Vmin,delta,y : matrix of 39*1
% H ,p : matrix of 46*1
X=10;
if Vmin(:,:) < V(:,:) < Ma(:,:) , abs(H(:,:)) < P(:,:), x < 382.99 ,abs(y(:,:))< delta(:,:)
r=(x/382.99)
else
r=inf
end
this condition not work?????
0 Kommentare
Antworten (4)
the cyclist
am 13 Mai 2013
You can only put one condition in the if statement.
I suggest you read
doc if
0 Kommentare
Youssef Khmou
am 13 Mai 2013
hi,
The cylist just answered , anyway you need "AND" Boolean operator :
if (Vmin(:,:) < V(:,:)) && (V(:,:) < Ma(:,:))
%....................
0 Kommentare
Lisa Wu
am 13 Mai 2013
if expression % your expression synax do not comply with matlab
statements
else
statements
end
The expression can not use "Vmin(:,:) < V(:,:) < Ma(:,:)" and "," between each expression, change the expression as :
%%if the function of "," is OR ,change "," as "||"
if (Vmin(:,:) < V(:,:)) && (V(:,:) < Ma(:,:)) || abs(H(:,:)) < P(:,:) ||x < 382.99 || abs(y(:,:))< delta(:,:)
% code
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!