How can I convert 2-D array to 1-D array.
2 views (last 30 days)
Show older comments
I am using a variable oprtn_pts. whose size is 3 2.
I want to convert this into 6*1. How can I do this?
0 Comments
Accepted Answer
Andrei Bobrov
on 18 Sep 2012
one way
out = oprtn_pts(:);
or
out = oprtn_pts.';
out = out(:);
other:
out = reshape(oprtn_pts,[],1);
or
out = reshape(oprtn_pts.',[],1);
0 Comments
More Answers (1)
Wayne King
on 18 Sep 2012
Edited: Wayne King
on 18 Sep 2012
oprtn_pts = randn(3,2);
oprtn_pts = reshape(a,6,1);
It takes the elements from oprtn_pts columnwise.
3 Comments
See Also
Categories
Find more on Data Type Conversion 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!