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

4 views (last 30 days)
desert_scientist90 on 29 Oct 2019
Commented: Walter Roberson on 29 Oct 2019
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?
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 CommentsShowHide 1 older comment
Walter Roberson on 29 Oct 2019
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.)