Code covered by the BSD License  

Highlights from
Sort data, plot means, std errors

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 3.4 KB File ID: #20181
image thumbnail

Sort data, plot means, std errors

by Don MacLeod

 

05 Jun 2008 (Updated 25 Oct 2009)

Given a matrix with y, x and z columns, plot graphs of y vs x for each z, with error bars.

| Watch this File

File Information
Description

Syntax: [curvestructarray, relevant_data] = meansemfun(datasource, xcolindex, ycolindex, zparamcolindex)

Given a data matrix (datasource) with columns for y, x and (optionally) z, sort the data and create a graph showing y vs x for each z, with error bars.

In the data matrix each row typically represents an observation, with columns for the independent (x axis) and dependent (y) variables. The second independent variable (z), if present, is used for distinguishing among different curves to be plotted. There can be any number of rows, with x and z (curve-parameter) values recurring in any order and with any frequency. The x values can be different for the different curves.
 
All arguments are optional. If no arguments are supplied, the user is asked to specify a file source for the data, by entering the name of a text file that contains the data matrix. Arguments 2:4 are the column indices for x, y, and (optionally) the curve parameter z; if these are missing, meansemfun asks the user to input them.

Meansemfun plots the mean and +-1 times the s.e.m. of y, versus x, for each value of the curve parameter z. It returns curvestructarray, an array of structures, one for each curve. Fields are X; mean of Y; standard error of the mean of Y; and number of observations, each as a column vectors ordered in ascending order of X; and the (scalar) curve parameter value z, if applicable. Also returned are the relevant data, suitably sorted.

MATLAB release MATLAB 7.3 (R2006b)
Other requirements Compatible back to at least Matlab 7.0, I believe. No need for toolboxes.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
09 Jun 2008

just a few extra keywords

09 Jul 2008

Tighter code, plot uses color

17 Jul 2008

Fixed bug in plot color selection

25 Oct 2009

comments

Tag Activity for this File
Tag Applied By Date/Time
statistics Don MacLeod 22 Oct 2008 10:04:53
probability Don MacLeod 22 Oct 2008 10:04:53
mean Don MacLeod 22 Oct 2008 10:04:53
standard error Don MacLeod 22 Oct 2008 10:04:53
sort Don MacLeod 22 Oct 2008 10:04:53
manipulate Don MacLeod 22 Oct 2008 10:04:53
organize Don MacLeod 22 Oct 2008 10:04:53
group Don MacLeod 22 Oct 2008 10:04:53
collect Don MacLeod 22 Oct 2008 10:04:53
plot Don MacLeod 22 Oct 2008 10:04:53
organize Markthomas 21 Apr 2010 12:15:48

Contact us at files@mathworks.com