Error for PlotData (How Should I Fix It)

clc;
clear all;
%% Pre setting
path_name_ref = 'C:\Users\night\Desktop\\reference';
imghei = 640;
imgwid = 880;
deltaZ = 71.972;
wScale = 1/0.992;
lamda_Start = 400;
lamda_End = 790;
lamda_Start_A = 400;
lamda_End_A = 685;
deltaZ = deltaZ*wScale;
lists = dir(path_name_ref);
n = length(lists);
imgnum_n=length(lists)-3;
imgnum = imgnum_n;
K_Start = floor(2*imgnum*deltaZ/lamda_End+1);
K_End = floor(2*imgnum*deltaZ/lamda_Start+1);
K_Real = (1:1:imgnum-1)*pi()/imgnum/deltaZ*1000;
K_Start_A = floor(2*imgnum*deltaZ/lamda_End_A+1);
K_End_A = floor(2*imgnum*deltaZ/lamda_Start_A+1);
%% Read Image
Data_Ref=zeros(imghei,imgwid,imgnum);
TMP=zeros(imghei,imgwid,3);
tDataR=zeros(imghei,imgwid);
valueR=zeros(imghei,imgwid);
RefFFTData=zeros(imghei,imgwid,imgnum);
ReflectanceData=zeros(imghei,imgwid,imgnum);
PlotData=zeros(imgnum);
for i=2:imgnum_n+1
TMP(:,:,:)=imread(sprintf('%s\\referenceimage_ (%d)',path_name_ref,i),'BMP');
Data(:,:,i-1)=TMP(:,:,1);
end
for i=1:imghei
for j=1:imgwid
tDataR = squeeze(Data(i,j,:))';
valueR = mean(tDataR(imgnum_n-20:imgnum_n));
Data_Ref(i,j,imgnum_n+1:imgnum) = valueR;
end
end
PlotData(:)=Data_Ref(200,200,:);
linspace(1,203,203)
plot(x,PlotData(x));
Hello, I am trying to plot data obtained from approximately 203 images but there seems to be an error at
PlotData(:)=Data_Ref(200,200,:);
It says element B and element A has to be the same, and I do not know how to fix the code for the plotted graph to show.
Thank you!

 Accepted Answer

Change
PlotData(:)=Data_Ref(200,200,:);
to
PlotData = squeeze( Data_Ref(200,200,:) );
Change
linspace(1,203,203)
plot(x,PlotData(x));
to
plot(PlotData);

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!