原帖由 kxin 于 2006-9-19 10:33 发表
还是不行,在同一个程序中是可以实现存储和保存路径,但我要在GUI中去调用,我把程序分开分别做在GUI和shili.m里,就实现不了了
function pushbutton1_Callback(hObject, eventdata, handles)
= uiputfile(' ...
加上参数传递就可以拉
function pushbutton1_Callback(hObject, eventdata, handles)
[file,path] = uiputfile('*.txt','Save Workspace As');
shili(path, file);
function shili(path, file)
x = 0:.1:1;
y = [x; exp(x)];
fid = fopen([path,file,'.txt'],'w');
fprintf(fid,'%6.2f %12.8f\n',y);
fclose(fid) |