Unable to perform assignment because brace indexing is not supported for variables of this type
1 view (last 30 days)
Show older comments
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 Comments
per isakson
on 29 Oct 2019
Edited: per isakson
on 29 Oct 2019
First run
dbstop if error
in the command window. The run your script. The execution will halt before throwing the error. Examine the values involved.
And see
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.)
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!