MATLAB Answers

0

Argument to dynamic structure reference must evaluate to a valid field name.

Asked by Shan Sha on 18 Sep 2018
Latest activity Edited by Walter Roberson
on 18 Sep 2018
Accepted Answer by KSSV
Argument to dynamic structure reference must
evaluate to a valid field name.
Error in godmake (line 43)
r=2/pi*(atan(c.(sqrt(((Ixx-Iyy).^2+4*Ixy.^2)/(Ix.^2+Iy.^2)))));
I m getting error in this.how to rectify this error?
my code is:
clc;
myFolder = 'G:\pro\aluminium_foil';
filePattern = fullfile(myFolder, '*.png');
jpegFiles = dir(filePattern);
sigma=2;
for k = 1:length(jpegFiles)
baseFileName = jpegFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
%fprintf(1, 'Now reading %s\n', fullFileName);
I = imread(fullFileName);
end
for s=1:length(sigma)
sigma = sigma(s);
Wx = floor(3*sigma);
x = [-Wx:Wx];
[xx,yy] = meshgrid(x,x);
g0 = -exp(-(xx.^2+yy.^2)/(2*sigma^2))/(2*pi*sigma^4);
F{s}.Gx = xx.*g0;
F{s}.Gy = yy.*g0;
F{s}.Gxx = (1-xx.^2/sigma^2).*g0;
F{s}.Gxy = -(xx.*yy/sigma^2).*g0;
F{s}.Gyy = (1-yy.^2/sigma^2).*g0;
sij = sigma;
Ix = sij*imfilter(I,F{s}.Gx ,'same', 'replicate');
Iy = sij*imfilter(I, F{s}.Gy, 'same', 'replicate');
Ixx = sij^2*imfilter(I, F{s}.Gxx, 'same', 'replicate');
Ixy = sij^2*imfilter(I, F{s}.Gxy, 'same', 'replicate');
Iyy = sij^2*imfilter(I, F{s}.Gyy, 'same', 'replicate');
Ix=double(Ix);
Iy=double(Iy);
Ixx=double(Ixx);
Ixy=double(Ixy);
Iyy=double(Iyy);
g = sqrt(Ix.*Ix + Iy.*Iy);
figure,imshow(g),title('g')
d = sqrt( (Ixx-Iyy).^2+ 4*Ixy.^2 );
figure,imshow(d),title('d')
SI = 0.5-1/pi*atan((-Ixx-Iyy)./sqrt((Ixx-Iyy).^2+ 4*Ixy.^2));
figure,imshow(SI),title('SI')
r=2/pi*(atan(c.(sqrt(((Ixx-Iyy).^2+4*Ixy.^2)/(Ix.^2+Iy.^2)))));
figure,imshow(r),title('r')
end
thanks in advance

  0 Comments

Sign in to comment.

1 Answer

Answer by KSSV
on 18 Sep 2018
 Accepted Answer

Replace that line by:
r=2/pi*(atan(c*(sqrt(((Ixx-Iyy).^2+4*Ixy.^2)/(Ix.^2+Iy.^2)))));
There is a typo error...instead of *, . has appeared, so MATLAB expecting c a structure.

  0 Comments

Sign in to comment.