I have a matrix 'M(1715*3849)' I want to reshape it to a Matrix that the size of the column can divisible with 12. How can I do it?
Thanks in advance.
>> 3849/12
ans =
320.7500

2 件のコメント

Turlough Hughes
Turlough Hughes 2020 年 3 月 10 日
Why do you want to do that, can you provide some context? There is no way to do it without removing values or adding empty values.
Farshid Daryabor
Farshid Daryabor 2020 年 3 月 10 日
Yes, adding empty values.

サインインしてコメントする。

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 3 月 10 日
編集済み: Ameer Hamza 2020 年 3 月 10 日

1 投票

It will append columns with nan value
M = rand(1715, 3849);
extra_columns = ceil(size(M,2)/12)*12 - size(M,2);
M = padarray(M, [0, extra_columns], nan, 'post');
size(M,2)/12
Result:
ans =
321

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by