Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: creating bar graph with user defined x-axis
Replies: 1   Last Post: Sep 19, 2013 9:55 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kenneth Potter

Posts: 11
Registered: 2/24/05
creating bar graph with user defined x-axis
Posted: Sep 19, 2013 9:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 10e-5])
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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.