
Exchanging Data Files between SIGNAL and MATLAB
Application Note 11 3
4. Example: read and plot the sample sound file C:\SIGNAL\TWEET.1. To convert and
display this file correctly, you must know its conversion format (12-bit A/D) and sample rate
(25000 Hz).
fid = fopen ('c:\signal\tweet.1','rb');
fseek(fid,1024,'bof');
A = fread (fid,inf,'int16');
A = (A - 2048.) / 204.8; % apply conversion factor
X = [0:(length(A)-1)] * (1/25000); % use sample rate to derive time base for plot
plot(X,A);
Headerless integer files
Headerless integer files are read in MATLAB by applying a data conversion factor.
1. Write the SIGNAL time buffer to a headerless integer time file. The following will write
time buffer 1 to headerless file IFILE in default 16-bit integer (/D) format. Default format has
an offset of 0 and a gain of 32768 bits/10 Volts, regardless of native A/D converter.
>W T 1 /B /D
Filename: IFILE
2. Read the file into a MATLAB array. The following MATLAB commands will read the
entire integer file IFILE into the array A and apply a conversion factor.
fid = fopen ('ifile','rb');
A = fread (fid,inf,'int16');
A = A / 3276.8;
Exporting floating point SIGNAL time and frequency files to
MATLAB
SIGNAL time buffers which have been manipulated after acquisition, as well as all power
spectra and spectrograms, should be transferred as floating point data, to maintain precision.
Floating point files are written in actual Volts, not bits, so no offset or gain conversion is
necessary. This section covers time and power spectrum files, which are stored as one-
dimensional arrays. Spectrograms are stored as two-dimensional arrays and are discussed in a
separate section below.
SIGNAL-header floating point files
1. Write the SIGNAL time buffer to a SIGNAL floating point time file:
>W T 1
Filename: RFILE
2. Read the file into a MATLAB array. The following MATLAB commands will read the
entire floating point file RFILE into array A, using FSEEK to skip the SIGNAL file header.
Comentários a estes Manuais