How can I set column of matrix divisible by 12

1 次查看(过去 30 天)
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.

请先登录,再进行评论。

采纳的回答

Ameer Hamza
Ameer Hamza 2020-3-10
编辑:Ameer Hamza 2020-3-10
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 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by