cat318520 发表于 2007-11-21 22:41

uicontrol中的callback里如何调用m文件?

pushbutton1=uicontrol(yWin,'style','pushbutton','Position',,'String','chuan','Callback',['Fun=chuan(15,4,0.001),union(ColorStr(Colornum),LineStr(1)))']);

pushbutton2=uicontrol(yWin,'style','pushbutton','Position',,'String','虚 线','Callback',['Fun=plot(x,sin(x),union(ColorStr(Colornum),LineStr(2)))']);

这是我定义的两个按纽,pushbutton2能够画出sin图象
而pushbutton1中的Fun=chuan(15,4,0.001),画不出来图. chuan(15,4,0.001)是我先生成的一个m文件的函数.单独运行chuan(15,4,0.001)时是可以的.
但放到这个CALLBACK里面就不行了,求教一下应该怎么才能调用那个chuan函数的m文件呢???????

非常感谢!

eight 发表于 2007-11-21 22:43

原帖由 cat318520 于 2007-11-21 22:41 发表 http://www.chinavib.com/forum/images/common/back.gif
pushbutton1=uicontrol(yWin,'style','pushbutton','Position',,'String','chuan','Callback',['Fun=chuan(15,4,0.001),union(ColorStr(Colornum),LineStr(1)))']);

pushbutton2=uicontrol(yWi ...
把 chuan.m 放在与 GUI界面的文件 同一目录下试试。如果还不行,copy chuan.m 的内容到 GUI界面的文件中
页: [1]
查看完整版本: uicontrol中的callback里如何调用m文件?