Writing S-Functions    

Example Involving a Pointer Work Vector

This example opens a file and stores the FILE pointer in the pointer-work vector.

The following statement, included in the mdlInitializeSizes function, indicates that the pointer-work vector is to contain one element.

The following code uses the pointer-work vector to store a FILE pointer, returned from the standard I/O function fopen.

This code retrieves the FILE pointer from the pointer-work vector and passes it to fclose to close the file.

The synopsis is

For an example, see matlabroot/simulink/src/sfun_dynsize.c.


  Work Vectors and Zero Crossings Memory Allocation