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}))])

採用された回答

Image Analyst
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 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by