List box with strings, Append those strings in the title of the figures when clicking on it.?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a List box. Which has strings say red, blue, green. An image is also there. when clicking the red, it should appear on the title of the figure, likewise next by clicking blue, it should append with red, likewise green also.
댓글 수: 0
채택된 답변
Image Analyst
2012년 8월 17일
Get the string property of the listbox to get all the items in the listbox. Get the value property to get which one on selected and use that as an index into the list of all the items. Then use sprintf() to create your string and use title() to display it atop the image.
댓글 수: 0
추가 답변 (1개)
Sean de Wolski
2012년 8월 17일
figure;
imshow('cameraman.tif');
str = {'red','green','blue'};
hL = uicontrol('style','list','string',str,...
'callback',@(src,evt)title(sprintf('Color is: %s',str{get(src,'value')})));
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!