Home  |  Overview  |  Documentation |  Download |  MATLAB API |  HowTo... |  FAQ |  Feedback

MATLAB Support


The SFS MATLAB API allows MATLAB programmers access to the rich data structures of SFS files and through them to the acquisition, signal processing, editing and display functions of SFS. The SFS MATLAB API allows scripts to be written in MATLAB to list the contents of SFS files, to read, write and create data sets. A utility program matlabex allows MATLAB functions to be called from the command line in the same way as other SFS programs.

Download and Installation

Version 2 supports 32-bit and 64-bit MATLAB!

Version 2.00 of the SFS MATLAB API can be downloaded from:

To install:

API Functions

The following functions are available in SFS MATLAB API:

sfsfile Performs file-level operations on SFS files. Test existence of SFS file, create new file, empty file, get list of file contents.
sfsgetitem Reads the contents of an SFS item into MATLAB. sfsgetitem returns the item header in a MATLAB structure and the data set as a MATLAB array. Information about the size, structure and provenenance of the item is present in the header structure.
sfsnewitem Creates a new empty SFS item consisting of a header structure and a data set in a form compatible with sfsputitem().
sfsputitem Writes the contents of a supplied header structure and data set to an SFS file as a new item.

Type help sfsgetitem etc at the MATLAB prompt to get more information about function use. There is a separate documentation file for the MATLABEX program.

API Example

Here is an example of the SFS MATLAB API being used

function sfsfilter(fname,item,hertz,ftype)
% SFSFILTER Applies a filter to a speech signal
%   SFSFILTER(fname,item,hertz,ftype) applies an 8th-order
%   Butterworth filter to the speech signal 'item' in the SFS
%   file fname.  The hertz parameter gives the cut-off frequency
%   (or frequencies) in hertz.  The ftype parameter selects the
%   filter type from: 'low'=low-pass, 'high'=high-pass, 'band'=
%   band-pass, 'stop'=band-stop.  The filtered speech is saved
%   back into the SFS file.
%   For example:
%      sfsfilter('file.sfs','1.01',1000,'low');
%      sfsfilter('file.sfs','sp',[1000 2000],'band');

% get item from SFS file (h=header, d=data set)
% make filter (uses butter() design from signal-processing toolbox)
if strcmp(ftype,'low') | strcmp(ftype,'band')
% make a new item header as copy of input item header
% create a suitable processing history string
if (length(hertz)==2)
% apply filter to input signal
% save filtered signal to file


Please send suggestions for improvements and reports of program faults to sfs@pals.ucl.ac.uk.

Please note that we are unable to provide help with the use of this software. <

Some other pages on our site you may enjoy:

CochSim - Cochlear Simulation teaching tool

CochSim is a dynamic simulation of the time and frequency analysis performed by the ear. Sound signals such as sinewaves, pulse trains, sawtooth waves and vowels can be fed into an auditory filterbank and the output monitored in a moving animated display. The program shows the vibration of the oval window and the basilar membrane, the haircell activity against filter frequency and time, and an average excitation pattern across the cochlea. More information.

ESYSTEM - Signals and Systems teaching tool

ESYSTEM is a free program for experimenting with signals and systems. With ESYSTEM you can see the effect of simple systems on a range of simple signals. More information.