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

Guillaume
Guillaume 2019년 10월 28일
So what should happen to the larger matrices? Remove columns at random?
Hinna Ahmed
Hinna Ahmed 2019년 10월 28일
yes the other columns can be removed/deleted.
Guillaume
Guillaume 2019년 10월 28일
Which other columns? Pick them at random? The first ones? the last ones? Some other criteria?
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일

0 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2019년 10월 28일

댓글:

2019년 10월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by