Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Creating a histogram

Asked by John on 31 Mar 2012

Hi,

Is the correct syntax to create a histogram of data X with 22 bins the following

hist(X,22)

When I type it noting happens?

0 Comments

John

Tags

Products

No products are associated with this question.

1 Answer

Answer by Wayne King on 31 Mar 2012
Accepted answer

That is correct. When you say "nothing happens", do you mean that the line of code executes, but no figure is produced? If so, try

    clf;
    X = randn(1000,1);
    hist(X,22);

3 Comments

John on 31 Mar 2012

Thanks - Yes, no figure is produce,

clf RESET gives this error though?

??? Error using ==> clo at 32
Unknown command option.

Error in ==> clf at 80
clo(fig, extra{:});

John on 31 Mar 2012

Got it working, thanks

Wayne King on 31 Mar 2012

yea, sorry about that! I fixed that :)

Wayne King

Contact us