|
楼主 |
发表于 2007-5-20 14:15
|
显示全部楼层
具体程序如下
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=guidata(jiemian);
l=handles.insignal;
prompt={'a1:','a2:','d'};
def={'10','1000','20'};
dlgtitle='choose';
lineno=1;
answer0=inputdlg(prompt,dlgtitle,lineno,def);
a1=str2double(answer0{1});
a2=str2double(answer0{2});
d=str2double(answer0{3});
y=l(a1:a2);
n=length(y);
N=5*n+45;
x1=[50:5:N];
x=x1';
s0=evalin('base','s0')
s1=evalin('base','s1')
if ((s1==0)&&(s0==1))
pcoef=polyfit(x,y,d);
xx=50:N;
yy=polyval(pcoef,xx);
loglog(x,exp(y),'g',xx,exp(yy),'r') ;
hold off
elseif((s1==1)&&(s0==0))
loglog(x,y,'g');
pcoef=polyfit(x,y,d);
xx=50:N;
yy=polyval(pcoef,xx);
loglog(exp(x),y,'g',exp(xx),yy,'r')
hold off
elseif((s1==1)&&(s0==1))
pcoef=polyfit(x,y,d);
xx=50:N;
yy=polyval(pcoef,xx);
loglog(x,y,'g',xx,yy,'r') ;
else
pcoef=polyfit(x,y,d);
xx=50:N;
yy=polyval(pcoef,xx);
plot(x,y,'g');
hold on
plot(xx,yy,'r');
fid = fopen('[path, file.dat]','wt');
fprintf(fid,' %15.12f\n',yy);
fclose(fid);
end
hold off
现在在save目录里面没有办法操作我在其下编的程序如下
fid(function save_Callback(hObject, eventdata, handles)
% hObject handle to save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.dat','Save As');
fid(path, file);
请高手指点一下:handshake :handshake |
|