combine 2 string to a listbox
显示 更早的评论
Hello... Like my question in http://www.mathworks.com/matlabcentral/answers/31729-make-history, I want to combine string from a popupmenu and 2 edittexts.. Example: the strings of popupmenu are
apple
mango
grapes
Then when i choose "mango", and in an edit text, i make the value is 80, in listbox it will be "mango, 80".. But, only "mango" and "grapes" that have edittext.. where, "mango" and "grapes" take the value from their text field. How i can combine them..?? i illustrate it like this http://www.flickr.com/photos/rye_ni/6969686871/. I have try to use these code, but they're not work..
pmFruitVal = get(handles.pmFruit, 'Value');
pmFruitStr = get(handles.pmFruit, 'string');
pmFruitSlc = pmFruitStr {pmFruitVal };
valFruit = str2num(get(handles.eFruit, 'String'));
if (pmFruitVal >1)
handles.cnt = handles.cnt + 1;
histstr = horzcat(pmFruitSlc, ', ', valFruit);
handles.history{handles.cnt} = histstr;
set(handles.listFruit, 'string', handles.history);
end
guidata(hObject,handles);
I really need your help.. i have try all of my ability.. But i can't get it.. Thank You.. :)
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Historical Contests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!