Unable to perform assignment because brace indexing is not supported for variables of this type

2 次查看(过去 30 天)
Hi all I am trying to compute the local significance at each grid point of my data set by using a student's t-test. If I run the loop line by line it seems to work but when I run it as one step I receive the following error message. Unable to perform assignment because brace indexing is not supported for variables of this type. How can I fix this issue when doing this loop?
Thanks in advance
varH{d} = var(P_High{d},0,3,'omitnan'); %this computes variance
varL{d} = var(P_Low{d},0,3,'omitnan');
n1 = 7;
n2 = 6;
for i = 1:141
for j = 1:71
sp{d}(i,j) = ((n1*varH{d}(i,j) + n2*varL{d}(i,j))/(n1+n2-2))^0.5;
t{d}(i,j) = diff{d}(i,j)/(sp{d}(i,j)*(1/n1 + 1/n2)^0.5);
num{d}(i,j) = ((varH{d}(i,j)/n1)+(varL{d}(i,j)/n2))^2;
denom{d}(i,j) = (n1-1)^-1 * (varH{d}(i,j)/n1)^2 + (n2-1)^-1 * (varL{d}(i,j)/n2)^2;
dof{d}(i,j) = num{d}(i,j) / denom{d}(i,j);
rou_dof{d}(i,j) = round(dof{d}(i,j)); %round off deg of Fre
if rou_dof{d}(i,j) > 0 %actually all positive
tcrit{d}(i,j) = CritT(0.05,rou_dof{d}(i,j),'two'); %try tstat
else
tcrit{d}(i,j) = rou_dof{d}(i,j);
end
end
end
  2 个评论
Walter Roberson
Walter Roberson 2019-10-29
You do not show the initialization for some of the variables. As outside observers, we can suspect that you might have incompatible values in the workspace. For example, perhaps you had assigned a numeric value to dof .
Also, it can be confusing to name a variable diff and MATLAB can get confused and think that it is a function under some circumstances (especially if you have load with no output variable named.)

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by