How can I modify the below code such that when clicking on a string from the list box, when clicking on another string it should append to the previously clicked string.
1 次查看(过去 30 天)
显示 更早的评论
How can I modify the below code such that when clicking on a string from the list box, when clicking on another string it should append to the previously clicked string.
function [] = newnew()
S.fh = figure('position',[400 450 500 200],...
'name','GUI_pop_to_list');
S.pp = uicontrol('style','list',...
'min',0,'max',2,...
'position',[20 90 190 100],...
'string',{'building';'grass';'tree';'cow';'boat';'sheep';'sky';'mountain'});
S.ls = uicontrol();
S.pb = uicontrol('style','push',...
'position',[20 20 190 40],...
'string','Transfer',...
'callback',{@pb_call,S});
uicontrol(S.pp)
function [] = pb_call(varargin)
S = varargin{3};
E = get(S.pp,{'string','value'});
STR = get(S.ls,'string');
set(S.ls,'string',[STR;subplot(1,2,2);imshow('attachment.jpg');title(E{1}(E{2}))])
0 个评论
采纳的回答
Image Analyst
2012-8-17
Instead of this mess:
set(S.ls,'string',[STR;subplot(1,2,2);imshow('attachment.jpg');title(E{1}(E{2}))])
why not make up your string with sprintf(),
myString = sprintf(........);
set(S.ls, 'String', myString);
I have no idea why you're trying to do an imshow() and a call to title() inside a call to send a string to a static text label. That just doesn't make sense at all.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String Parsing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!