Fliping a value between zero and one
古いコメントを表示
When p=0;
I have to use a loop to flip the value of p between 0 and 1 and each time it has to be different in a single line of code.
Thank you
2 件のコメント
Image Analyst
2013 年 2 月 15 日
What does the "When p=0;" mean? You only have to flip when p=0???
When you say "flip the value of p between 0 and 1" does that mean that p is either 0 or 1 only, or does it mean p can have a value between 0 and 1, like p=.426973 and flipping means inverting like flipped_p = 1-p?
Rooy
2013 年 2 月 15 日
採用された回答
その他の回答 (2 件)
Youssef Khmou
2013 年 2 月 14 日
編集済み: Youssef Khmou
2013 年 2 月 14 日
your_vector=mod(0:1000,2); % single line code
for i=1:length(your_vector)
% YOUR CODE
fprintf('%d\n',your_vector(i))
pause(0.3)
end
Youssef Khmou
2013 年 2 月 14 日
for i=1:N
if mod(i,2)==0
R(i)=1;
end
end
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!