フィルターのクリア

Labeling a bar graph with names in MATLAB GUI

2 ビュー (過去 30 日間)
Stuart
Stuart 2013 年 4 月 14 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeBar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by