subscipted assignment dimension mismatch
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all;
I have 2 time series, two columns (attached). and just trying to use the code (attached) for the ADCC (mutlivariate) model as written by Kevin Sheppard.
Instead of calling the function direclty. I just copy and past step by step to understand what is going on. I definded the inputs as follows:
data = time series attached
(imported from my desktop) then converted to A T by K matrix of zero mean residuals by
[T,k] = size(data);
data2d = data;
eta = data.*(data<0);
data = zeros(k,k,T);
dataAsym = [];
m=1;
l=1;
n=1;
p=1;
o =0;
q=1;
gjrType = [];
method = 'diagonal;
composite = [];
startingVals = [];
options = [];
once I copy and paste the first part of the code:
if ndims(data)==2
[T,k] = size(data);
data2d = data;
eta = data.*(data<0);
data = zeros(k,k,T);
dataAsym = zeros(k,k,T);
for t=1:T
data(:,:,t) = data2d(t,:)'*data2d(t,:);
dataAsym(:,:,t) = eta(t,:)'*eta(t,:);
end
elseif ndims(data)==3
[k,~,T]=size(data);
data2d = zeros(k,k,T);
for i=1:k
data2d(:,i) = squeeze((1-2*(dataAsym(i,i,:)==0)) .* sqrt(data(i,i,:)));
end
else
error('DATA must be either a K by T matrix of a K by K by T 3-dimensional array.')
end
if ~isempty(dataAsym)
if ndims(dataAsym)~=3
error('DATAASYM must be a K by K by T array.')
end
[k1,k2,T2] = size(dataAsym);
if k1~=k || k2~=k || T2~=T
error('DATAASYM must be a K by K by T array.')
end
end
I got the following the error message: Subscripted assignemnt dimension mismatch"
I am using MATLAB 2013a.
please see attached data and code and advice.
1 commentaire
Walter Roberson
le 25 Nov 2015
Which line does the error occur on? Please include the complete error message, everything in red.
Réponses (0)
Voir également
Catégories
En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!