필터 지우기
필터 지우기

how can i combine arrays of different size.

조회 수: 8 (최근 30일)
zhoug zho
zhoug zho 2021년 5월 31일
답변: Walter Roberson 2021년 5월 31일
i have six arrays of size as given in figure.
i need to combine all arrays one after the other.
but the problem is they are of different dimenion.
how can i combine all these arrays?
thanks in advance.
  댓글 수: 4
zhoug zho
zhoug zho 2021년 5월 31일
yes, pad with zeros.
zhoug zho
zhoug zho 2021년 5월 31일
편집: zhoug zho 2021년 5월 31일
how can i combine these arrays by padding with NaN or zeros.?

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 5월 31일
sizes = cell2mat(cellfun(@size, YourCell(:), 'uniform', 0));
maxcols = max(sizes(:,2));
combined = cell2mat(cellfun(@(M) [M, zeros(size(M,1), maxcols-size(M,2))], YourCell(:), 'uniform', 0));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by