multiple inputs through gui to workspace

5 次查看(过去 30 天)
Hello. I have a premade function which accept varargin, up to 4 inputs. Also, I have made a listbox in a gui which can be chosen up to 4. I have made seperated push button which will open up the another figure to plot with the inputs that user chose in list box.
Following is the code I would like to try.
  • plotting is the function I made, which will contains up to 4 inputs.(1,2,3 inputs are still ok)
  • Convsig is a list box, And Plot is a push button
  • Convsig will contain the set of variables as a list, and user choose the variables to plot
  • After choosing the variables in Convsig, user press the 'Plot' button.
function Convsig_Callback(hObject, eventdata, handles)
contents = cellstr(get(hObject,'String'));
signals=contents{get(hObject,'Value')};
set(handles.Convsig,'String',signals);
function Plot_Callback(hObject, eventdata, handles)
plotsig=handles.Convsig;
evalin('base',plotting(plotsig));
I want to input the inputs that user chose from listbox and transfer those inputs into the .m function I made, which accept input as varargin format. Can anybody suggest a solution? Thank you!!
  1 个评论
Walter Roberson
Walter Roberson 2017-8-14
What is the purpose of using evalin('base') to do the plotting? Graphics objects do not get deleted when the function that plots them returns, so it would not matter for plotting purposes if you called plotting() directly or in the base workspace. Are you expecting plotting to use assignin() to output values to the base workspace? If so then you could just assignin('base') instead of having to run the complete function inside the base workspace.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by