WHY EVERY TIME I AM GETTING THE ERROR "Cell contents assignment to a non-cell array object." I need to store the value of "ISG" which is a one dimensional array(array elements changes for every i,j) into every cell of "VarIsg" .. PLEASE HELP ME OUT

2 Ansichten (letzte 30 Tage)
for i=1:3
for j=1:3
mat_cor= InsideSquareCoordinate2{i,j};
mat_data=InsideSquareGrade2{i,j};
mat_data=mat_data(mat_data~=0);
mat_dl=length(mat_data);
%%%%%%%%%%%****-----------------------------------------------------------------------------------------****%
% mat_data(:,n1)
% n1=1;
% if ~isempty (InsideSquareCoordinate2{i,j})
VarIsg=0;
tempPointCord=InsideSquareCoordinate2{i,j};
xCordInside=tempPointCord(:,1);
yCordInside=tempPointCord(:,2);
for i1=1:mat_dl
for j1=1:mat_dl
if (i1~=j1)
d=sqrt((xCordInside(i1)-xCordInside(j1))^2 + (yCordInside(i1)-yCordInside(j1))^2);
if((xCordInside(j1)-yCordInside(i1))==0)
theta=90;
else
theta=180.*atan((yCordInside(j1)-yCordInside(i1))./(xCordInside(j1)-yCordInside(i1)))./pi;
end
minlag=10; nlag=3; laginv=10; clear('ISG')
for k=1:nlag
llag(k)=minlag+(k-1)*laginv;
hlag(k)=llag(k)+laginv;
b=abs(d.*sin(theta-azm));
if((llag(k)<=d && d<hlag(k))&&(lowangle<=theta &&theta<upangle)&&(b<=maxbandw))
ISG(k)= sum((mat_data(i1)- mat_data(j1)).^2)/(2*mat_dl);
end
end
ISG
VarIsg{i,j}=ISG
end
end
end
% ISG
% VarIsg{i,j}=0;
end
end

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 20 Jul. 2018
You have
VarIsg=0;
so VarIsg is numeric.
Later you do
VarIsg{i,j}=ISG
which attempts to access VarIsg as if it is a cell array. But it is not a cell array, it is numeric.
Your line
VarIsg=0;
should probably be
VarIsg{i,j} = 0;

Weitere Antworten (1)

RAJ DATTA
RAJ DATTA am 29 Jul. 2018
thank u all for your valuable replies...it works..

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by