필터 지우기
필터 지우기

Making Matrix Dimensions Equal

조회 수: 2 (최근 30일)
Hinna Ahmed
Hinna Ahmed 2019년 10월 28일
댓글: Hinna Ahmed 2019년 10월 28일
Hey,
I have this cell with 12 different matrix. They are all of different size in length. How can I make all of them equal to 501 x 53 in size.
  댓글 수: 5
Hinna Ahmed
Hinna Ahmed 2019년 10월 28일
the last ones
Hinna Ahmed
Hinna Ahmed 2019년 10월 28일
for instances, the matrix in the first row has a size of 501 x 55, so to chnage its size to 501 x 53, column 54 and 55 should be deleated.

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

채택된 답변

Guillaume
Guillaume 2019년 10월 28일
smallestwidth = min(cellfun('size', yourcellarray, 2)); %smallest width of all matrices in the cell array
newcellarray = cellfun(@(m) m(:, 1:smallestwidth), yourcellarray, 'UniformOutput', false); %crop all matrices inside the cell array to the smallest width
  댓글 수: 1
Hinna Ahmed
Hinna Ahmed 2019년 10월 28일
Thank you so much!!!

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

추가 답변 (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