<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>save</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="save"> saving variables in binary files</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>save(filename [,x1,x2,...,xn])  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>save(fd [,x1,x2,...,xn])  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>filename</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: character string containing the path of the file</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>fd</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a file descriptor given by a call to mopen</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>xi</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: arbitrary Scilab variable(s)</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>The <VERB>save</VERB> command can be used to save Scilab current variables 
     in a binary file. If a variable is a graphic handle, the <VERB>save</VERB> function
      saves all the corresponding <LINK>graphics_entities</LINK> definition. </P>
    <P>The file can be given either by its paths or
    by its descriptor previously given by <VERB>mopen</VERB>.</P>
    <P><VERB>save(filename)</VERB> saves all current variables in the file defined
    by  <VERB>filename</VERB>.</P>
    <P><VERB>save(fd)</VERB> saves all current variables in the file defined
    by  the descriptor <VERB>fd</VERB>.</P>
    <P><VERB>save(filename,x,y)</VERB> or <VERB>save(fd,x,y)</VERB> saves only named
    variables <VERB>x</VERB> and <VERB>y</VERB>.</P>
    <P>Saved  variables can be reloaded by the <VERB>load</VERB> command.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
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','r+')
mseek(0,fd,'end') 
lst=list(1,2,3)
save(fd,lst)
mclose(fd)

 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>load</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>save_format</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>mopen</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
