Whats the difference between the two statements
1 次查看(过去 30 天)
显示 更早的评论
Difference between
(reshape(key,2,[])')
and
reshape(key,2,[])
0 个评论
回答(2 个)
Cris LaPierre
2020-12-13
"Specify [] for the first dimension to let reshape automatically calculate the appropriate number of rows."
If you specify [] in the second dimention, it will automatically determine the appropriate number of columns for the specified number of rows.
1 个评论
Cris LaPierre
2020-12-13
Ah, missed the transpose (the apostrophe) after the first one. That transposes the results of reshape. It's probably just easiest to test it and see:
key = magic(4);
reshape(key,2,[])'
reshape(key,2,[])
Another way is to just swap the 2 and the [].
reshape(key,[],2)
Bruno Luong
2020-12-13
The second creates 2-row matrix.
The first creates 2-column matrix, since it make a transpose after reshape.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!