i want to make a for loop that goes like this for a=0:1:180 && 179:-1:-180 but it is not possible in matlab, any ideas how to do it?
조회 수: 1 (최근 30일)
이전 댓글 표시
i want to make a for loop that goes like this for a=0:1:180 && 179:-1:-180 but it is not possible in matlab, any ideas how to do it?
i cant use the && or the in matlab and i cant find any other way to do it!
댓글 수: 3
Stephen23
2016년 12월 3일
편집: Stephen23
2016년 12월 3일
"i mean it is not possible to use && or for the and expression"
The short circuit AND operator && works perfectly, exactly as per the documentation. Did you read it?
>> 1 && (1 || 0)
ans = 1
채택된 답변
James Tursa
2016년 11월 30일
편집: James Tursa
2016년 11월 30일
It is not clear to me what you really want. Maybe this?
for a=[0:1:180,179:-1:-180]
% whatever
end
추가 답변 (1개)
Star Strider
2016년 11월 30일
You need to concatenate the vectors, not logically ‘and’. See if this does what you want:
q = [];
for a=[0:1:180 179:-1:-180]
q = [q a];
end
plot(q)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!