【发布时间】:2014-11-06 11:05:03
【问题描述】:
我是 Matlab 的新手。现在的任务是在 GUI 中显示标题并在脚本运行时不断更新标题。
我创建了一个名为 Interface 的 GUI,所以 Main 中的脚本是
Interface(title);
在图形界面中
function Interface_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Interface (see VARARGIN)
% Choose default command line output for Interface
handles.output = hObject;
handles.title = varargin{1};
% Update handles structure
guidata(hObject, handles);
我将标题传递给handles.title。
在静态文本的回调函数中:
title =get( handles.title,'Value');
set(handles.text1,'String',title');
它一直给我错误消息说我正在阅读“尝试引用非结构数组的字段。”
感谢您的帮助
【问题讨论】:
-
set(handles.text1,'String',title');在title之后有一个'不属于那里。
标签: matlab user-interface