"if condition not worked"
조회 수: 1 (최근 30일)
이전 댓글 표시
% 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
답변 (4개)
the cyclist
2013년 5월 13일
You can only put one condition in the if statement.
I suggest you read
doc if
댓글 수: 0
Youssef Khmou
2013년 5월 13일
hi,
The cylist just answered , anyway you need "AND" Boolean operator :
if (Vmin(:,:) < V(:,:)) && (V(:,:) < Ma(:,:))
%....................
댓글 수: 0
Lisa Wu
2013년 5월 13일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!