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
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
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 Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!