File I/O C S-function Example 1.0

Operating systemsOS : Windows / Linux / Mac OS / BSD / Solaris
Program licensingScript Licensing : Freeware
CreatedCreated : Sep 27, 2007
Size downloadDownloads : 7
Program licensing
Thank you for voting...

S-functions are used to create user defined blocks in ...

S-functions are used to create user defined blocks in Simulink. This S-function creates a block that reads data from a file incrementally at each time step of the Simulink simulation.
The S-function was written in C and uses the standard file I/O functions from the stdio. h library (fopen, fscanf, fclose). It is intended merely as an example.
The trickiest part of writing S-functions can sometimes be maintaining persistent data in subsequent calls to the S-function. This issue presents itself in this example. In order to read from the file throughout the simulation without closing and reopening the file each time step, the FILE pointer is stored in the PWork vector. This gives the S-function access to the FILE pointer at each step in the simulation.
In this S-function, the mdlStart function opens the file at the start of the simulation and the mdlTerminate function closes the file at the end. The mdlOutputs function is used to read data from the file at every time step.
To run the example:
1) Enter
mex -setup
at the MATLAB Command Prompt and select a compiler
2) Copy the attached files to the current MATLAB directory
3) Enter
mex cfileiosfun. c
to compile the S-function
4) Open the attached model and simulate.
Demands:
• MATLAB Release: R2006b
• Simulink

File I/O C S-function Example 1.0 scripting tags: data, sfunction, file, scientific engineering, file s-function example, step. What is new in File I/O C S-function Example 1.0 software script? - Unable to find File I/O C S-function Example 1.0 news. What is improvements are expecting? Newly-made File I/O C S-function Example 1.1 will be downloaded from here. You may download directly. Please write the reviews of the File I/O C S-function Example. License limitations are unspecified.