0

我正在尝试在 Octave(4.0.1,使用 GUI 版本)中开发一个 GUI,代码如下:

  • 主要图形界面功能
    • 创建图形和各种功能uicontrol
    • uicontrol#1的回调函数
    • uicontrol#2的回调函数
    • uicontrol#3的回调函数
    • ETC...

每个函数由function&分隔end。我尝试编写的第一个回调如下所示:按钮在“图形创建”函数中定义为:

gui.select_btn = uicontrol('Style','pushbutton','String','Select log file ...',...
                'Units','normalized','Position',[0.01 0.52 0.25 0.47],...
                'BackgroundColor',get(gui.Window,'Color'),'Parent',gui.file_panel,...
                'Enable','on','Callback',{@browse_log_file,gui});

并且它的回调在稍后的回调函数中定义为:

function browse_log_file(src,data,gui)
  % Called when user presses the "Select log file ..." button
  [fname, pname] = uigetfile({'*.log'},'Select log file');          
  set(gui.log_file_edit,'String',[pname,fname]);
end

通过调用“图形创建”函数在主GUI函数guistruct定义并可由所有嵌套函数访问。

但是,当我尝试运行代码时,我收到以下错误消息:

error: handles to nested functions are not yet supported
error: called from
    GUI_analyser>create_interface at line 71 column 20
    GUI_analyser at line 8 column 7
error: evaluating argument list element number 1
error: called from
    GUI_analyser>create_interface at line 71 column 20
    GUI_analyser at line 8 column 7
error: evaluating argument list element number 16
error: called from
    GUI_analyser>create_interface at line 71 column 20
    GUI_analyser at line 8 column 7

指向带有 的线{@browse_log_file,gui}

关于如何解决这个问题的任何建议?

4

0 回答 0