Borrar filtros
Borrar filtros

"if condition not worked"

1 visualización (últimos 30 días)
mahmoud abdallah
mahmoud abdallah el 13 de Mayo de 2013
% 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?????

Respuestas (4)

the cyclist
the cyclist el 13 de Mayo de 2013
You can only put one condition in the if statement.
I suggest you read
doc if

Youssef  Khmou
Youssef Khmou el 13 de Mayo de 2013
hi,
The cylist just answered , anyway you need "AND" Boolean operator :
if (Vmin(:,:) < V(:,:)) && (V(:,:) < Ma(:,:))
%....................

Yao Li
Yao Li el 13 de Mayo de 2013
You must define the logical relationships between the conditions

Lisa Wu
Lisa Wu el 13 de Mayo de 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

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by