From: "Sadik " <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Calling function during the same script run repeatedly
Date: Fri, 26 Oct 2012 00:17:09 +0000 (UTC)
Organization: University of North Carolina
Lines: 1
Message-ID: <k6ckq5$sg8$>
References: <k6as33$rn7$>
Reply-To: "Sadik " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1351210629 29192 (26 Oct 2012 00:17:09 GMT)
NNTP-Posting-Date: Fri, 26 Oct 2012 00:17:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: comp.soft-sys.matlab:781439

You can generate a random number within your script each time you run it. A better one that avoids having the same ID more than once is keeping a variable in your base workspace and never clearing it and incrementing it each time you run your script. This will serve as a process ID. You will also define an additional input to your function to get this ID from the script. Now you know from which script your function is being called. You also had better put this ID into the name of the text files as a prefix so that you will never delete a text file.