Borrar filtros
Borrar filtros

error with "reshape"

2 visualizaciones (últimos 30 días)
za
za el 2 de Jun. de 2017
Respondida: KSSV el 2 de Jun. de 2017
% 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?

Respuestas (1)

KSSV
KSSV el 2 de Jun. de 2017
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.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by