How I can Remove a specific Items from listbox and get its name into a variable??
2 ビュー (過去 30 日間)
古いコメントを表示
i got the code to delete an item from listbox.... now,,, what if i want to get the name of the deleted item in a variable?? for ex there are 4 images in my listbox... image1.jpg,image2.jpg,image3.jpg and image4.jpg..... i delete image3.jpg... now i want the name image3.jpg in a variable... how to do that... please reply...
0 件のコメント
採用された回答
Walter Roberson
2012 年 10 月 27 日
By then it is too late. Keep track of the item before you delete it.
2 件のコメント
Walter Roberson
2012 年 10 月 27 日
curidx = get(hObject, 'Value');
curstrings = get(hObject, 'String');
variable = curstrings{curidx};
curstrings(curidx) = []; %delete it in this list
set(hObject, 'String', curstrings); write new list in
Now the variable named "variable" will hold the string.
msgbox( sprintf('Deleting from list: %s', variable) );
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!