How to save some variable values in a file
<p>I want at the end of my program to get the values stored at certain variables and append them to a file let's say "result". I am going to run it several times (for different parameters) at night and then check results in the morning.</p>

<p>Basically, I am looking for something similar to redirection in linux (>>) for matlab.</p>

<p>I am using the diary function to store the whole messages from my program and i want to keep those for verifying later. </p>

<p>But here what I want is just some specific values. So how to do it?</p>

<p>It does not necessary have to be in the same file. If I can get each result in a separate file, that is ok too.</p>