필터 지우기
필터 지우기

creating zero matrices all together!

조회 수: 1 (최근 30일)
etcann
etcann 2011년 12월 18일
Hi people!
I want to create a bunch of zero matrices of size with no distinct regularities 3*3 5*5 9*9 and 50*50 for example. Is there any way I can
  1. make them conveniently using for loop or something and
  2. name them using the size index
instead of
m3=zeros(3,3)
m5=zeros(5,5)
m9=zeros(9,9)
m50=zeros(50,50)
I used to do it with SAS but wonder if matlab can do it too.
Lots of thanks!!!

답변 (2개)

Walter Roberson
Walter Roberson 2011년 12월 18일
  댓글 수: 1
etcann
etcann 2011년 12월 18일
Lots of help! Thanks :)

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2011년 12월 18일
You can make a cell array, where each cell contains a different sized array:
desiredSizes = [3 5 9 50];
for k = 1 : length(desiredSizes);
arrays{k} = zeros(desiredSizes(k));
end

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by