フィルターのクリア

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 ビュー (過去 30 日間)
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

採用された回答

Walter Roberson
Walter Roberson 2018 年 7 月 20 日
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;
  2 件のコメント
Walter Roberson
Walter Roberson 2018 年 7 月 20 日
It would probably be a good idea to put
VarIsg = cell(mat_dl, mat_dl);
before the loop, while still maintaining the
VarIsg{i,j} = 0;
within the loop.

サインインしてコメントする。

その他の回答 (1 件)

RAJ DATTA
RAJ DATTA 2018 年 7 月 29 日
thank u all for your valuable replies...it works..

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by