how to understand .sc .mat in matlab
Show older comments
Hello,i cant see the logic of these two lines taken from the full code shown bellow.
i know that its some how plotting an area but .mat .sc are resembling . command from c# of object oriented.
How to understand the meaning of the two lines shown bellow?
Is there any material i could use explaining examples for this structs?
Thanks
func_in.mat=NmidCirc;
func_in.sc=scale;
full code:
lambda=633e-9;% wave length in [m]
L=0.01;% meter factor, it is defined that 1cm=1024 pixels-> the first scale will be over 1cm
scale=linspace(-L/2,L/2,n);% basic scaling vector in length of 1024.
%% Q2 creating matrix
[X, Y]= meshgrid(scale,scale);% creating the basic function. on the function we will create the images that will operated
midCirc= X.^2+Y.^2<(1/n)^2;%because we work in meter units, the 100/1024[cm] transforms into 1/1024[m]
NmidCirc=not(midCirc);
Ring= ((X-0.8/n).^2+(Y-0.8/n).^2<(1/n)^2)&((X-0.8/n).^2+(Y-0.8/n).^2>(0.6/n)^2);
NRing=not(Ring);
Tshape= (abs(Y)<0.2/n)&(abs(X)<0.6/n) | ((Y<1.4/n)&(Y>0.2/n)&(abs(X)<0.2/n))
%%%% Negative cirle part
func_in.mat=NmidCirc;
func_in.sc=scale;
figure(2)
colormap gray
for j=1:6
func_out=Rdiv(func_in,lambda,Z(j),n);
subplot(2,3,j);
image(func_out.sc, func_out.sc, abs(func_out.mat), 'CDataMapping','scaled');
xlabel('[m]');
ylabel('[m]');
title(['Z=',num2str(Z(j))]);
end
Answers (1)
The command func_in.mat = ... creates the struct "func_in" with the field "mat". See:
doc struct
A web search is a good strategy also, e.g. for "Matlab struct":
Categories
Find more on Environment and Settings 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!