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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by