[ top | up ]

Format for Segment Statistics

Programs written to compute statistics on data must follow certain conventions if they are to be compatible with the rest of the software, particularly hrsegment. These conventions are:

Calling syntax

The functions must have this calling syntax

[ntimes,nvals,nlabels] = thisfunction(times,values,labels,params);

The argument params can contain whatever parameters need to be handed off to the statistic (e.g., band limits in spectral analysis).

There is no need actually to use any of the arguments --- that depends on what your statistic is intended to do --- but they must be there.

When called with no arguments, or one argument, document yourself

When called with no arguments, or just one argument, the function should return values that document itself. In particular, the value of ntimes should be the number of columns that will be in the returned variable when the function is called with real arguments. Similarly, nvals should be the number of columns that will be in nvals. nlabels should contain a character matrix that describes the returned variables. See simpstat for an example.

Note that when the function is called with just one argument, this is intended to be the parameter params. Note that inside the function, these values will be assigned to the variable times because that is the name of the first argument. Thus, in the code handling the zero- or one-argument case, you should have a line like params = times. This is an unfortunate confusion, but Matlab doesn't provide named arguments.

See Also

Examples