How do I reshape a large matrix?
显示 更早的评论
I am trying to reshape a matrix so that it keeps a consistent amount of columns (8 columns) and the number of rows is ever changing. These rows change because of modifications to number of iterations of a for loop. I know that the correct syntax to use is the reshape function but is it possible to not explicitly state the number of rows and/or columns so that the matrix will automatically reshape to 9 columns and "X" rows? Thanks!
采纳的回答
更多回答(1 个)
B=reshape(A,[],9);
The kicker is that mod(numel(A),9)==0 or will fail or will have to pad/truncate A.
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!