Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: M files must be run twice for changes to take effect on linux
Date: Mon, 2 Mar 2009 11:08:05 -0500
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <goh095$dlk$1@fred.mathworks.com>
References: <fcul58$kac$1@fred.mathworks.com> <fd0hqp$4s2$1@fred.mathworks.com> <fiqr4h$44t$1@fred.mathworks.com> <gogsqd$pbe$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1236010085 14004 144.212.105.187 (2 Mar 2009 16:08:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 2 Mar 2009 16:08:05 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:521916



"Seth " <neologism+matlab@gmail.com> wrote in message 
news:gogsqd$pbe$1@fred.mathworks.com...
>I had exactly this same problem (R2008b on mac), where I wrote a .m file as 
>output from a script, and then ran it both using the "run" command and by 
>opening it up in the editor and choosing "Run...". The only way it would 
>recognize the change was to either modify the .m script in the editor (even 
>if the "new" file was written), or to use the "clear functions" command.
>
> Matlab ought to at least check the modification dates of files it runs to 
> determine whether it can use cached versions. Having to know about and 
> exectue "clear functions" is not acceptable.

Where did you save this M-file?  If you saved it in a directory under 
$MATLABROOT/toolbox, then we strongly recommend you save it elsewhere.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f8-28521.html

If you didn't save it under the toolbox directory, did you save it on a 
network drive?  If the network drive doesn't inform MATLAB that the file has 
changed promptly (or at all), MATLAB may not learn that the function has 
changed until you clear it from memory, at which time MATLAB has to ask the 
network drive for a new copy of the function to load into memory.

-- 
Steve Lord
slord@mathworks.com