I have built an application that plots data from items selected from a listbox. The listbox has multi-select enabled so I can plot multiple items.
When I use the below code, the default legend item names are "data1", "data2" ,etc., but i want to be able to use the app.ActiveChannelsListBox.Items as the legend entries. I know i am able to change the legend names using the property app.UIAxes.Legend.String, but the problem is that if i have only 3 list box items selected i have no way of accessing only the selected variable names to assign as legend items.
legend(app.UIAxes)if length(app.ActiveChannelsListBox.Value) == 1 plot(app.UIAxes, app.TimeData, app.ActiveChannelsListBox.Value{1})elseif length(app.ActiveChannelsListBox.Value) == 2 plot(app.UIAxes, app.TimeData, app.ActiveChannelsListBox.Value{1}) hold on plot(app.UIAxes, app.TimeData, app.ActiveChannelsListBox.Value{2}) hold off%elseif statements repeated to allow plotting using up to 16 list box selections
end
Best Answer