populate a listbox in a GUIDE gui through a function call from a Matlab script (.m file)
显示 更早的评论
While Im quite comfortable with functions and scripts in matlab, this is my first time venturing into GUIDE guis. I created a figure containing a listbox, a drop down list as well as a plot. The idea is to call this gui from a Matlab script under certain conditions, populating the listbox with a list of files. The user would select a plot "profile" from the drop down list which will then select the appropriate plots to show.
At this point Im struggling with just getting the listbox to update properly. I saved my gui generated from GUIDE as svt_plotter, which I call from my script with:
H= svt_plotter({'A','B'});
In the svt_plotter.m file I added the following line in svt_plotter_OpeningFcn just before the call to update handles structure: handles.list = varargin{1}; %save the input argument to be used in the listbox function later. This is a straight call right now with no logic to see if it works
finally I added this line to update the listbox under listbox1_CreateFcn set(hObject, 'String', handles.list);
When I do this I get an error 'Attempt to reference field of non-structure array.'. Replacing the handles.list with the explicit cell array works just fine. What am I missing here?
Any good reference document that can help in understanding GuIDE code and how to interact with it would be much appreciated.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!