How can break a 1D array to matrix?

조회 수: 2 (최근 30일)
Zara Khan
Zara Khan 2020년 12월 30일
댓글: Image Analyst 2020년 12월 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.

답변 (1개)

Image Analyst
Image Analyst 2020년 12월 30일
Try this:
m = reshape(v, 320, []);
where v is your vector and m is your 2-D matrix.
  댓글 수: 2
Zara Khan
Zara Khan 2020년 12월 30일
m is becoming a size of 320 X 480
Image Analyst
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);

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by