Inserting an array in another to make an Nested Array
이전 댓글 표시
Hello I want to build a fractal. I want to start with One=[1 0 1;0 0 0;1 0 1] Zero=zeros(3)
Then I want to search this array for an element =1 if equal to "1" insert the array One otherwise the array Zero. I am pretty sure this can be done with Cat but wanted to see what others think.
Thanks for your time.
댓글 수: 2
James Tursa
2015년 2월 27일
Please provide a complete example of inputs and desired output. "insert the array" really doesn't tell us much about what you really want.
thiirane
2015년 2월 28일
채택된 답변
추가 답변 (1개)
Roger Stafford
2015년 2월 28일
편집: Roger Stafford
2015년 2월 28일
ONE = [1 0 1;0 0 0;1 0 1];
M = (your current matrix of 1's and 0's)
M = kron(M,ONE); % This will be the next version of M
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!