eric-rzq 发表于 2007-5-20 12:57

如何保存数据

如何在gui界面里面保存新生成的数据,最好是能够在界面上直接输入保存的名字

eric-rzq 发表于 2007-5-20 14:15

具体程序如下

function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdatareserved - 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=;
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('','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)
% eventdatareserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
= uiputfile('*.dat','Save As');
fid(path, file);
请高手指点一下:handshake :handshake

eight 发表于 2007-5-20 23:11

原帖由 eric-rzq 于 2007-5-20 14:15 发表 http://www.chinavib.com/forum/images/common/back.gif
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdatareserved - to be defined in a future version of MATLAB
% handles    struct ...


help save
页: [1]
查看完整版本: 如何保存数据