Un-concatenate a vector to a matrix
3 次查看(过去 30 天)
显示 更早的评论
Lets say I have a 1x100 vector and I want to split it up into a 10x10 matrix. i.e:
vec1 = [100]
mat1 = [1-10;11-20;21-30; ... ;91-100]
is there a simple command for that?
0 个评论
回答(2 个)
Image Analyst
2023-2-7
Try this:
% Define vec1:
vec1 = 100;
% Create mat1:
mat1 = reshape(1:vec1, 10, [])' % Reshape into 10 rows.
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!