Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



creating bar graph with user defined xaxis
Posted:
Sep 19, 2013 9:22 AM


Dear Colleagues,
I have written some simple code to define two arrays to create a bar graph.
The data is put into the following array creating three groups. Where devices are not present I have added zeros to ensure the dimensions match.
bar_graph = [Exact_Threshold_WB1 Exact_Threshold_WB2... Exact_Threshold_WB7 Exact_Threshold_WB7 0 0
Exact_Threshold_WS1 Exact_Threshold_WS2... Exact_Threshold_WS3 Exact_Threshold_WS4... Exact_Threshold_WS5 Exact_Threshold_WS6
Exact_Threshold_WB3 Exact_Threshold_WB4 0 0 0 0];
%%
I have then tried to create another array of string values to state which each bar represents and have again left string values blank using '' where devices are not present as follows.
x_axis = ['Device B1' 'Device B2' 'Device B7' 'Device B8' '' '' 'Device S1' 'Device S2' 'Device S3' 'Device S4' 'Device S5'... 'Device S6' 'Device B3''Device B4' '' '' '' ''];
%% Plot results
figure %replace with string to increment figures per graph generation set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % Maximize figure SetPlotFont('Times',18); %additional *.m file which must be included axis auto %set(gca, 'XTick',[1 2 3]) %axis([8 6 0 10e5]) hold all bar(x_axis, bar_graph)
colormap summer grid on title('Comparison of Threshold Voltage'); ylabel('Threshold Voltage [V]') xlabel('Device');
But I receive the following error:
Error using vertcat Dimensions of matrices being concatenated are not consistent.
Is anyone able to help?
Many thanks, Ken.
MATLAB 2012b, Windows 7.



