why am i getting an error for counts in histogram?

2 views (last 30 days)
I am trying to display the counts in my histogram, but I keep getting an error message stating 'Too many output arguments'.
Speed = HPperformance(:,23);
[n,x] = histogram(Speed.GPSSpeed_knots_);
h.BinEdges = [1:20];
barstrings = num2str(n');
text(x,n,barstrings,'horizontalalignment','center','verticalalignment','bottom')

Answers (1)

Image Analyst
Image Analyst on 24 Mar 2018
What kind of variables are HPperformance and Speed? Apparently Speed is a structure. Is HPperformance a structure array? If so, Speed would be a column vector of structures. Since I don't really know what these variables are (yet), about all I can suggest is to try to concatenate the values:
histogram([Speed.GPSSpeed_knots_]);
  2 Comments
Rashdeep Singh
Rashdeep Singh on 24 Mar 2018
HPperformance is my main database from which i'm extracting only the GPSspeed and putting it in Speed. the photo of the histogram is attached. I want to show the counts for each bar.
Image Analyst
Image Analyst on 24 Mar 2018
You didn't answer my question. I don't think they are databases. If you do this:
whos HPperformance
whos Speed
What do you see in the command window when these execute? I don't think it will say that they're "databases" it will say a regular MATLAB variable type like structure, cell array, double, or whatever. Please do that, then read this link first and then paste ALL THE RED TEXT of your error message.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!