Using data from timetable to make a histogram

16 views (last 30 days)
I have a timetable TT1. I would like to make a histogram out of it, where the x axis shows the std deviation(stddev1) and the y axis is the count.
  1 Comment
Adam Danz
Adam Danz on 13 Aug 2020
Edited: Adam Danz on 17 Aug 2020
@Shamus Sim, it looks like you've received lots of useful feedback from many volunteers in the forum but you haven't accepted any of the answers to your questions. If the answer addressed your question, accepting it is a way of thanking the volunteers who helped you and it highlights working solutions for future visitors who may have the same question.
Here are your questions:

Sign in to comment.

Answers (2)

Adam Danz
Adam Danz on 13 Aug 2020
Use histogram(x) where x is your data TT1.stddev1.
See that link of additional syntaxes that allow you to set the bins.

Gilberto Luis Galvis Marquez
Dear Shamus, Next I show you the code with the solution you are looking for. You will see the histogram generated by MATLAB as you describe it.
Additionally, I show you a solution using the matlab_plotly library. This library allows you to create the version of that chart (histogram) but in Plotly, which is much more elegant.
Using MATLAB only:
load TT1.mat
histogram(TT1.stddev1)
xlabel('stddev1')
ylabel('counts')
title('histogram for TT1.stddev1')
Using MATLAB+PLOTLY
The matlab_plotly library is open source. You can download and install it by following the simple steps of the following links, respectively: Getting Started Guide. PART I: Download, Getting Started Guide. PART II: Installation.
matlab_plotly is very easy to use, you just need to invoke the fig2plotly function at the end of the MATLAB code. For this case, the code would be the following
load TT1.mat
histogram(TT1.stddev1)
xlabel('stddev1')
ylabel('counts')
title('histogram for TT1.stddev1')
% create the histogram in plotly
fig2plotly(gcf, 'offline', 'false');
By executing the above code, the Plotly chart will be displayed in your web browser in the direction of Plotly-Chart-Studio. Next I leave you the link that will be displayed in your browser:
Please open that link to see the magnificence of the histogram created by matlab_plotly
Using MATLAB+PLOTLY in offline mode
In addition, you also can create pltoly charts using offline mode from matlab_plotly. You only need to set fig2plotly line as follow
% create the histogram in plotly
fig2plotly(gcf, 'offline', 'true');
When executing the code in offline mode, fig2plotly creates an HTML file that contains the Plotly version of the chart (histogram) and will also display this HTML file in your web browser. Bellow I show you an screenshot of my result

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!