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
per isakson
per isakson 2019년 10월 29일
편집: per isakson 2019년 10월 29일
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
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