How can break a 1D array to matrix?
1 次查看(过去 30 天)
显示 更早的评论
I have a 1D array of length 153600 X 1. I want to break this array into 320 X 240 matrix how to do that . Value in the 1D array has been attached in a notepad.
0 个评论
回答(1 个)
Image Analyst
2020-12-30
Try this:
m = reshape(v, 320, []);
where v is your vector and m is your 2-D matrix.
2 个评论
Image Analyst
2020-12-30
So do you want the left half of that
leftHalfImage = m(:, 1:240);
or the right half image
rightHalfImage = m(:, 241:end);
另请参阅
类别
在 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!