フィルターのクリア

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 Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by