Extracting data from a structure

1 view (last 30 days)
james eyres
james eyres on 4 May 2014
Commented: james eyres on 5 May 2014
I want to plot a line of best fit onto a histogram, and the quickest way I know how is to plot the data points using cftool...
fibre_length_regular=load('fibre_length_regular.txt'); % The data I want to plot
h1=hist(fibre_length_regular,75); % simple way of saving the y data of the histogram, with number of bins specified
x=1:75; % arbitrary number of bins
cftool;
I create a new data set of h1 vs x. Then create a line of best fit using the 'Fitting' tab. Then check the: 'evaluate fit', 'for function', and 'integrate to xi' boxes on the 'Analysis' tab. This gives me 'fxi', 'lowerfxi' and 'upperfxi'= line of best fit with 95% confidence intervals. Then on the same tab I click 'save to workspace' which saves these 3 arrays in a structure called 'analysisresults1'
All I need to know is how do I then use the arrays in the structure 'analysisresults1'? I have used this method before but unfortunately it was too long ago for me to remember the function that i used (I literally just need one line of code to access the arrays from the editor)
Thanks in anticipation.
  2 Comments
Star Strider
Star Strider on 4 May 2014
What functions are you using to fit your distribution? It seems like dfittool, but we need to know if we need to experiment with it. The description is important for us to understand what you’re doing and what you want. Posting relevant parts of your code will clarify it.
james eyres
james eyres on 5 May 2014
I'm using
hist(fibre_length_regular,75);
to plot the histogram. Then i'll probably just:
hold on; plot(yfit,x);
to plot the line of best fit (where yfit is the line of best fit from 'cftool' currently stuck in the structure) over the histogram.
The only part i'm stuck on is how to extract yfit from this structure. I have all the data I need from cftool, I basically just want the histogram to look pretty for a report.
Hope I understood the request

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!