Effacer les filtres
Effacer les filtres

error with "reshape"

2 vues (au cours des 30 derniers jours)
za
za le 2 Juin 2017
Réponse apportée : KSSV le 2 Juin 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?

Réponses (1)

KSSV
KSSV le 2 Juin 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.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by