How do I write data from a C-MEX S-function into a file?

I would like to write data from a C-MEX S-function into a file.

 Akzeptierte Antwort

There is an example model and an S-function that you can download below.
You will have to compile the S-function using the following command:
mex fileout2.c
This example file will write every 10th data point to the file. A DWork vector is used to keep count of the number of data points.You should take a look at the mdlStart Callback that opens a file and then gets a pointer to the file. You should also take a look at the mdlTerminate Callback that will close the file.

Weitere Antworten (0)

Kategorien

Mehr zu Block and Blockset Authoring finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by