为什么会出现此错误:矩阵G
的大小为 4x50,而我留下了 2 个维度来接受数组?
Beta_Correlations;???下标分配尺寸不匹配。
==> Beta_Correlations 中的错误在 28 Correl_betas(j,k,l,:,:)=G;
Correl_betas=zeros(50,50,size(rates,1),4);
mats=[1:50]';
L1=-1;
for j=1:51
L1=L1+1;
L2=-1;
for k=1:51
L2=L2+1;
for l=1:size(rates,1)
y2=rates(l,mats2);
yM=rates(l,:);
dataList=struct('yM',yM,'mats',mats,'model',@NSS,'mats2',mats2,'y2',y2);
lambda=[ L1; L2 ];
nObs=size(mats,1);
G= [ones(nObs,1) (1-exp(-mats./lambda(1)))./(mats./lambda(1)) ((1-exp(-mats./lambda(1)))./(mats./lambda(1))-exp(-mats./lambda(1))) ((1-exp(-mats./lambda(2)))./(mats./lambda(2))-exp(-mats./lambda(2)))];
Correl_betas(j,k,l,:,:)=G;
check1=Correl_betas(1,1,1,:);
end
end
end