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!