How to Add selected values of Listbox in MATLAB GUI?
Show older comments
function listbox1_Callback(hObject, eventdata, handles)
contents= cellstr(get(hObject,'String'));
listchoice=contents(get(hObject,'Value'));
if(strcmp(listchoice,'a'))
lis1=10;
elseif(strcmp(listchoice,'b'))
lis1=20;
elseif(strcmp(listchoice,'c'))
lis1=30;
elseif(strcmp(listchoice,'d'))
lis1=40;
elseif(strcmp(listchoice,'e'))
lis1=50;
end
assignin('base','lis1',lis1);
i have created a listbox with five options with their respected values and when i select more than 1 option , I want the result to be added in the respective listbox.
6 Comments
Ankit
on 18 Sep 2019
what do you mean by result to be added in the respective listbox?
You mean transfer selected options (more than 1) to another listbox?
ANURAG DEEPAK
on 18 Sep 2019
Ankit
on 19 Sep 2019
your listbox1_Callback returns single value according to your code.
ANURAG DEEPAK
on 19 Sep 2019
Ankit
on 19 Sep 2019
ANURAG DEEPAK
on 19 Sep 2019
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!