%function [temp_finalmean]=first_difference_mean
%calculate the first difference between two column
files=dir('*.mat');temp_save=zeros(30,359);for m= 1:length(files) load(files(m).name) temp_temp=zeros(30,359); temp_thickness=cell2mat(T(1,1)); temp_thickness=image2polar(temp_thickness,peaks(1,1)*200/668,peaks(2,1)*200/668,'counterclockwise',[],1,pi/180,'linear'); temp_size=size(temp_thickness); temp_thickness(62:temp_size(1),:)=[]; temp_thickness(1:31,:)=[]; disp(['Loading ' num2str(m) ' files']) for n=1:359 for k=1:30 temp_temp(k,n)=temp_thickness(k,n+1)-temp_thickness(k,n); end end temp_save=temp_save+temp_temp;end temp_finalmean=temp_save/length(files);end
If I remove the top line and bottom line(i.e. the function and end),then I will have my code run perfectly. I mean I can get different result from the same code, it is strange… Is it I can't use load() in a function or something happened?
Thank you
Best Answer