下面黄色字删掉,可以运行,而存在的话点open后提示变量未定义。

function test()

clf reset;

%[Data,Test] = xlsread('d:\matlab\work\ZirconHf.exp','A1:J501'); %read in excel data

%[filename, pathname] = uigetfile;

%if (filename==0 & pathname==0)

%   msgbox('您没有选择文件,请重新选择!','打开文件出错','error');

%    break;

%else

%Data=xlsread([pathname, filename]);

% 然后把从计算机其它文件夹读取的数据文件保存到当前文件夹

%  save NumericalDatum.dat NumericalDatum -ascii;

% xlswrite('NumericalDatum.xls',NumericalDatum);

%  msgbox('打开及读取数据完毕!','确认','warn');

%end

set(gcf,'unit','normalized','position',[0.1,0.2,0.64,0.35]);

set(gcf,'defaultuicontrolunits','normalized');

set(gcf,'defaultuicontrolfontsize',12);

set(gcf,'defaultuicontrolfontname','隶书');

str='ZirconHf data process';

set(gcf,'name',str,'numbertitle','off');

h_axes=axes('position',[0.03,0.2,0.55,0.7]);

set(h_axes,'xlim',[1,450]);

H_Voline1=line([200 200],[0 10]);

set(H_Voline1,'color','g')

H_Voline2=line([400 400],[0 10]);

set(H_Voline2,'color','g')

H_scale=[120 450 0 10];

axis(H_scale);

z=200;str1='Start pos.=';

htext1=uicontrol(gcf,'style','text',...         %add a static text

'position',[0.67,0.8,0.15,0.1],'string',[str1,sprintf('%1.4g\',z)]);

hslider1=uicontrol(gcf,'style','slider',...     %add a slider

'position',[0.83,0.8,0.15,0.1],'max',300,'min',150,...   %limit the slider larger than 150 and smaller than 300

'sliderstep',[0.02,0.02],...          %step for slider_arrow and for slider

'value',200);          %default value

s=400;str4='Stop pos.=';

htext2=uicontrol(gcf,'style','text',...         %add a static text

'position',[0.67,0.65,0.15,0.1],'string',[str4,sprintf('%1.4g\',s)]);

hslider2=uicontrol(gcf,'style','slider',...     %add a slider

'position',[0.83,0.65,0.15,0.1],'max',450,'min',300,...   %limit the slider larger than 300 and smaller than 450

'sliderstep',[0.02,0.02],...          %step for slider_arrow and for slider

'value',400);          %default value

str2='176Hf/177Hf=';ratio=0.0;

htextHf=uicontrol(gcf,'style','text',...         %add a static text

'position',[0.67,0.50,0.33,0.11],'string',[str2,sprintf('%1.6g\',ratio)]);

str3='SE=';sterr=0.0;

htextHfSE=uicontrol(gcf,'style','text',...         %add a static text

'position',[0.67,0.35,0.33,0.11],'string',[str3,sprintf('%1.6g\',sterr)]);

Judge=0;

PushSave=uicontrol(gcf,'style','push','position',[0.67,0.08,0.15,0.11],'string','Save');

str5='None';

htext3=uicontrol(gcf,'style','text',...         %add a static text

'position',[0.67,0.2,0.15,0.1],'string',str5);

PushOpen=uicontrol(gcf,'style','push','position',[0.83,0.2,0.15,0.11],'string','Open');

set(hslider1,'callback',['z=get(gco,''value'');','callslider(htext1,htext2,htextHf,htextHfSE,str1,str2,str3,str4,z,s,Data,filename,Judge)']);  %call function callcheck

set(hslider2,'callback',['s=get(gco,''value'');','callslider(htext1,htext2,htextHf,htextHfSE,str1,str2,str3,str4,z,s,Data,filename,Judge)']);  %call function callcheck

set(PushSave,'callback',['Judge=1;','callslider(htext1,htext2,htextHf,htextHfSE,str1,str2,str3,str4,z,s,Data,filename,Judge)']);  %call function callcheck

set(PushOpen,'callback',['[filename, pathname] = uigetfile;','Data=xlsread([pathname, filename]);','set(htext3,''string'',filename);',...

'for i=13:20; Data(200:400,i)=Data(200:400,i-10)-mean(Data(10:90,i-10)); end;',...

'Data(200:400,22)=log(1.132338*Data(200:400,13)./Data(200:400,14))/log(172.9382/170.9363);',...

'Data(200:400,23)=log(0.7325*Data(200:400,17)./Data(200:400,19))/log(178.946/176.943);','hline=plot(Data(1:450,20))']);

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐