필터 지우기
필터 지우기

Show in Listbox specific variables of workspace (GUI)

조회 수: 6 (최근 30일)
Christine Abou Nasr
Christine Abou Nasr 2017년 5월 15일
편집: Christine Abou Nasr 2017년 5월 18일
Hello, I have two listboxes in a GUI and i would like to show in each one of my listbox different variables of my workspace. I tried doing :
function update_listbox(handles)
vars = evalin('base', 'who');
vars1 = evalin('base', 'name_var_wksp');
set(handles.listbox6,'String',vars)
set(handles.listbox7,'String',vars1)
but it gives me the values of the variable and not the name, in the listbox. I would just like to have the string in the listbox in order to plot later. Using matlab R2013a.
Thanks!

답변 (1개)

Megha Parthasarathy
Megha Parthasarathy 2017년 5월 17일
Hello,
Refer to the example in this documentation page: Plot Workspace Variables in a GUIDE App
  댓글 수: 1
Christine Abou Nasr
Christine Abou Nasr 2017년 5월 18일
편집: Christine Abou Nasr 2017년 5월 18일
Actually I ended up finding the answer. In those examples i couldn't find what i was looking for.
The code that works would be to have in one listbox:
function update_listbox2(handles)
vars1 = evalin('base','who(''Var5'',''Var6'')');
set(handles.listbox2,'String', vars1)
And to have in the other listbox:
function update_listbox1(handles)
vars = evalin('base','who(''Var1'', ''Var2'',''Var3'',''Var4'')');
set(handles.listbox1,'String',vars)
Var1, Var2.... being variables in the workspace.

댓글을 달려면 로그인하십시오.

카테고리

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