Un-concatenate a vector to a matrix
2 views (last 30 days)
Show older comments
Andrew MacPhee on 6 Feb 2023
Answered: Image Analyst on 7 Feb 2023
Lets say I have a 1x100 vector and I want to split it up into a 10x10 matrix. i.e:
vec1 = 
mat1 = [1-10;11-20;21-30; ... ;91-100]
is there a simple command for that?
Image Analyst on 7 Feb 2023
% Define vec1:
vec1 = 100;
% Create mat1:
mat1 = reshape(1:vec1, 10, )' % Reshape into 10 rows.
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!