Borrar filtros
Borrar filtros

Labeling a bar graph with names in MATLAB GUI

2 visualizaciones (últimos 30 días)
Stuart
Stuart el 14 de Abr. de 2013
Hi there,
I am trying to plot a bar graph in MATLAB to show the power rating of appliances. The variable which hold all the appliances names and power is called databaseApps of type cell and looks like the following:
databaseApps={'tv',50;'kettle',100};
I have tried various methods to plot a bar graph in the GUI with little success:
bar(handles.axes1,databaseApps(:,1),cell2mat(databaseApps(:,2))) This just says arrays must be numeric or logic.
bar(handles.axes1,cell2mat(databaseApps(:,2)) Then tried to use the set function to set the tick labels but an error appears saying values must be handles: set(get(handles.axes1,'XTickLabel'),databaseApps(:,1));
The only thing that seems to work is if I use gca but this is risky because I have more than one axes and the labels do not line up well with the bars. Any suggestions?
Cheers
Stuart

Respuestas (0)

Categorías

Más información sobre Bar Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by