5.0

5.0 | 1 rating Rate this file 15 downloads (last 30 days) File Size: 36.86 KB File ID: #9986

savedata

by Giampiero Campa

 

14 Feb 2006 (Updated 23 Oct 2007)

Code covered by the BSD License  

Saves data to a file at the end of the simulation

Download Now | Watch this File

File Information
Description

This block is similar to the "To File" original simulink block, except for the following points:

1) It does not access the file system during the simulation, in fact it collects data in memory and saves them to file only when the simulation is over. This is important for real time systems, where normally access to the file system by processes running in real time has to be avoided.

2) It can save any type of data instead of just doubles.

3) It has a lot of flexibility in saving the data, different format and precisons can be selected form the block mask.

4) When using the %d, %f or %e options, the file is an ASCII file that can be opened with any text editor as well as easily loaded into matlab or excel.

This code is derived from an original s-function written by G.Campa and S.Gururajan for simulink schemes running in real time under RTAI-Linux.

MATLAB release MATLAB 5.3.1 (R11.1)
Zip File Content  
Other Files savedata.c,
savedata.dll,
savedata.mexw32,
savetofile.mdl
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
01 Mar 2006 Rocco Dell'Aquila

Great Job !!!

Please login to add a comment or rating.
Updates
21 Feb 2006

1) Minor fixes to the mask and model.
2) mdlInitializeSizes now uses "DTypeId" instead of "int", so it's more formally correct and robust to possible future changes by TMW in the way data types are handled.

23 Oct 2007

Recompiled the s-function with matlab 7.1 so that everything works fine with newer versions requiring the .mexw32 extension. The .dll files is retained to the benefit users working with versions prior to 7.1, other users may delete it.

Tag Activity for this File
Tag Applied By Date/Time
simulink Giampiero Campa 22 Oct 2008 08:15:44
save Giampiero Campa 22 Oct 2008 08:15:44
to file Giampiero Campa 22 Oct 2008 08:15:44
to workspace Giampiero Campa 22 Oct 2008 08:15:44
log Giampiero Campa 22 Oct 2008 08:15:44
logging Giampiero Campa 22 Oct 2008 08:15:44
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com