MATLAB: List box with strings, Append those strings in the title of the figures when clicking on it.

list boxMATLAB

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.

Best Answer

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.