필터 지우기
필터 지우기

reshape problem in matlab

조회 수: 4 (최근 30일)
evangeline
evangeline 2014년 1월 22일
댓글: evangeline 2014년 1월 22일
I have a 2D matrix, which is: h=zeros(65536,1); now when I use the: h = reshape(h, 256, 256); i get the error: To RESHAPE the number of elements must not change. but the number of elements are the same on both matrixes, what should I do?

채택된 답변

the cyclist
the cyclist 2014년 1월 22일
This code works for me just fine:
h = zeros(65536,1)
h = reshape(h, 256, 256);
Are you 100% sure you are not doing something in between those two lines that changes the shape of h? I suggest you insert the line
N = numel(h)
just before you do the resize, just to be sure.
  댓글 수: 1
evangeline
evangeline 2014년 1월 22일
so I guess I should check my code, thanks

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by