Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.
See the recommended documentation of this function
Save a variable or a serie of variables in a binary file
save(filename [,x1,x2,...,xn]) save(fd [,x1,x2,...,xn])
Character string containing the path of the file
A file descriptor given by a call to mopen
Arbitrary Scilab variable(s)
save command can be used to save Scilab
current variables in a binary file. If a variable is a graphic handle, the
save function saves all the corresponding graphics_entities definition.
The file can be given either by its paths or by its descriptor
previously given by
save(filename) saves all current variables in the
file defined by
save(fd) saves all current variables in the file
defined by the descriptor
fd. This prototype is obsolete and will be removed in Scilab 6.
y variables of your environment) saves only named variables
save(fd,x,y) is obsolete and will be removed in Scilab 6.
"y" names of variables of your environment) will save your data using the SOD (Scilab Open Data) format (based on HDF5), format that will be readable by Scilab 6 family.
save(filename,"-append","w", "z") (with
"z" names of variables of your environment) will append your data in the existing SOD file called
The change of format between the family 5 and 6 of Scilab has been decided because the 5 format is undocumented, not specified and hard to read. SOD (Scilab 6 default format) is fully documented and easy to read through HDF5 libraries or applications.
Saved variables can be reloaded by the
Note that the written file is portable to other operating systems and architectures (little and big endian).
// Binary format readable up to Scilab 5 family a=eye(2,2);b=ones(a); save('val.dat',a,b); clear a clear b load('val.dat','a','b'); // sequential save into a file fd=mopen('TMPDIR/foo','wb') for k=1:4, x=k^2;save(fd,x,k),end mclose(fd) fd=mopen('TMPDIR/foo','rb') for i=1:4, load(fd,'x','k');x,k,end mclose(fd) // appending variables to an old save file fd=mopen('TMPDIR/foo','rb+') mseek(0,fd,'end') lst=list(1,2,3) save(fd,lst) mclose(fd) // Binary format readable by Scilab 5.4.X and Scilab 6 family a=eye(2,2);b=ones(a); save("val.sod", "a", "b"); clear a clear b load("val.sod", "a", "b");
|5.0.0||All uimenu or uicontrol handles are also saved by this function.|
|Report an issue|
|<< readb||Entrées/Sorties||writb >>|