Logical Manipulation of Vector
1 回表示 (過去 30 日間)
古いコメントを表示
I require a logical vector with 'a' number of rows =1 and followed by 'b' rows =0. How can I create this without if statements?
I know a and b.
3 件のコメント
採用された回答
その他の回答 (2 件)
Walter Roberson
2011 年 9 月 5 日
Something like,
kron([true;false],[a;b])
Unfortunately I cannot reach my server today to test this.
2 件のコメント
Oleg Komarov
2011 年 9 月 5 日
It could have been the most elegant, although with some overhead but the result is:
ans =
10
15
0
0
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!