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
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!