GUI IN MATLAB 2021B, HOW TO SELSCT LISTBOX

3 次查看(过去 30 天)
HI
how i change the color map of figure in GUI by ListBox Items:{ jet hot cool .....} using GUI
  3 个评论
Walter Roberson
Walter Roberson 2024-7-23
selected_colormap = Items{app.ColormapListBox.Value};
That should be
selected_colormap = Items{app.ColormapListBox.ValueIndex};
Walter Roberson
Walter Roberson 2024-7-23
Better would be
function ColormapListBoxValueChanged(app, event)
selected_colormap = app.ColormapListBox.Value;
colormap(app.UIAxes, selected_colormap)
end

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2024-7-23
Create a listbox with the colormap names. Set the callback for the listbox to execute
Colormap_name = app.LISTBOXNAME.Value;
colormap(app.FIGURENAME, Colormap_name);

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by