create an array
조회 수: 1 (최근 30일)
이전 댓글 표시
I wonder how I can make an array (200,400) with values 0 to 7 which randomly distributed? I apperciate your help.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Sean de Wolski
2011년 6월 30일
szs = [20 20 30]; %sizes
vals = [1 0 2]; %values
C = cellfun(@(c,v)ones(c)*v,num2cell(szs),num2cell(vals),'uni',false);
M = blkdiag(C{:});
댓글 수: 3
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!