User`s guide

9 Working with Target PC Files and File Systems
1 Ifyouhavenotalreadydoneso,intheMATLABwindow,typethefollowing
to assign the
xpctarget.fs object to a variable.
fsys=xpctarget.fs;
2 Type
h=fsys.fopen('data.dat');
or
h=fopen(fsys,'data.dat');
This opens the file data.dat f o r reading and assigns the file identifier to h.
3 Type
data2=fsys.fread(h);
or
data2=fread(fsys,h);
This reads the file data.dat and stores the contents of the file to data2.
This content is in the xPC Target file format.
4 Type
fsys.fclose(h);
This closes the file data.dat.
Before you can view o r plot the contents of this file, you must convert the
contents. See “Converting xPC Target File Format Content to D ouble
Precision Data” on page 9-12.
Converting xPC Target File Format Content to Double Precision
Data
The xPC Target software provides the script readxpcfile.m to convert xPC
Target file format content (in bytes) to double precision data representing the
signals and timestamps. T he
readxpcfile.m script takes in data from a file
9-12