Generate file suitable for use by real-time From File block (not recommended)


xpcbytes2file(filename,var1,. . .,varn)



Name of the data file from which the From File block distributes data.

var1,. . .,varn

Column of data to be output to the model.


xpcbytes2file(filename,var1,. . .,varn) outputs one column of var1, . . .,varn from file filename at every time step. All variables must have the same number of columns; the number of rows and data types can differ.

If the data is organized such that a row refers to a single time step and not a column. pass to xpcbytes2file the transpose of the variable. To optimize file writes, organize the data in columns.


In the following example, to use the real-time From File block to output a variable errorval (single precision, scalar) and velocity (double, width 3) at every time step, you can generate the file with the command:

xpcbytes2file('myfile', errorval, velocity)

where errorval has class 'single' and dimensions [1 x N] and velocity has class 'double' and dimensions [3 x N].

Set up the real-time From File block to output

28 bytes
(1 * sizeof('single') + 3 * sizeof('double'))

at every sample time.

Was this topic helpful?