How can i remove this logical operator error?
조회 수: 2 (최근 30일)
이전 댓글 표시
Operands to the || and && operators must be convertible to logical scalar values.
Error in parentProgram (line 2)
if((positive_sum<datestr('0,30','HH,MM')) && (negative_sum<datestr('1,00','HH,MM')))
Where am i going wrong?
댓글 수: 0
채택된 답변
Jos (10584)
2014년 6월 30일
One of the terms is not convertible to a logical scalar. Most likely, one or both of these terms are arrays. What does
size(positive_sum<datestr('0,30','HH,MM')
give you? It should be 1x1 to be used in conjunction with &&.
May be the functions ALL or ANY can help you out:
if all((positive_sum<datestr('0,30','HH,MM')) && all (negative_sum<datestr('1,00','HH,MM')))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!