Creating Histogram using .mat file
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to create a histogram. I used a .mat file to create a 1x5000 structure. I am trying to plot only 1000 out of the 5000, so I call 'a' and set the length to 1000 in a for loop, but it says it is only plotting one data point instead of them all. Any idea what I am doing wrong? Thanks!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/347310/image.png)
2 件のコメント
Stephen23
2020 年 8 月 18 日
1000 is a scalar number, so length(1000) is one, so your loop will iterate exactly once.
採用された回答
Cris LaPierre
2020 年 8 月 18 日
I suspect your don't really want to create 1000 histograms. You don't need a for loop.
Try
histogram([a(1:1000).time])
7 件のコメント
Cris LaPierre
2020 年 8 月 18 日
I think you'd have to do it like this:
histogram([a(1:1000).time]/1e3)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!