필터 지우기
필터 지우기

error with "reshape"

조회 수: 2 (최근 30일)
za
za 2017년 6월 2일
답변: KSSV 2017년 6월 2일
% Set parameters
H=36;
ns=47;
% n=37;
% Data are sorted as:
% [oil1,ci1_5,ci1_10,oil2,ci2_5,ci2_10]
% for each column, (2H+2) IRFs, from sect=1 to sect=ns.
oil1=data(:,1);
ci1_5=data(:,2);
ci1_10=data(:,3);
oil2=data(:,4);
ci2_5=data(:,5);
ci2_10=data(:,6);
oil1=reshape(oil1,2*H+2,ns);
ci1_5=reshape(ci1_5,2*H+2,ns);
ci1_10=reshape(ci1_10,2*H+2,ns);
oil2=reshape(oil2,2*H+2,ns);
ci2_5=reshape(ci2_5,2*H+2,ns);
ci2_10=reshape(ci2_10,2*H+2,ns);
What's wrong in using reshape in the above context?

답변 (1개)

KSSV
KSSV 2017년 6월 2일
Read the documentation of reshape. When you reshape a array with n elements, the resultant reshaped array too should have n elements. If they are not in match, error pops.
In your case, you are trying to reshape into a array, in which the above condition is not satisfying.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by