想用matlab打印像excel那种bar chat下面显示种类名字的,不过matlab默认都是,1,2,3,4这样的数字,添加种类名字还比较折腾,后来发现一个比较简单的方法,相当于直接把1,2,3这样的数字给替换掉,而画的时候还是1,2,3这样的基本画法,只是最后一个名字的替换而已,例子如下:
plot_bar_chat.m
% example
% use the bar chat to show the time of which label
% Edward.xu in must
% 2012,9,19
clear all;
%bar(x);
%set(gca,'xtick',1:3,'xticklabel',{'-','a','ac'});
% CW = 31~1023
list_x1=[72932 1310 189 401 261 180 9200 180 1488 7136 401 3741 4744 180 180 22873 581 ...
582 581 3741 582 3741 401 5418 189 3309 581 221 761];
subplot(2,1,1);
list_x1=list_x1./72932;
bar(list_x1,'k');
xlabel('CW = 31~1023');
set(gca,'xtick',1:29,'xticklabel',{'fun','Txtimepsz','SendDATA','SendHandler','RecvDATA','DeferHandler','CheckBackoffTimer','CheckPktCTRL', ...
'Collosoion','Txtimep','SendTimer','RecvHandler','Discard','RecvACK','SendACK','IsIdle','Transmit', ...
'CheckPktRTS','TxHandler','RxResume','BackoffHandler','RecvTimer','SendRTS','Recv','Send','NavHandler', ...
'CheckPktTx','RetransmitDATA','TxResume'});