Path: news.mathworks.com!newsfeed-00.mathworks.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Christian Zietz <newsgroup@chzsoft.com.ar>
Newsgroups: comp.soft-sys.matlab
Subject: Saving an anonymous function handle to a mat-file
Date: Fri, 12 Sep 2008 14:34:49 +0200
Lines: 18
Message-ID: <6iv5vcFn3i0U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net Ibovw0PUCV7xLrvz/BubMA6clhkUb3eAVtijbnE8Piu5GpwQ==
Cancel-Lock: sha1:jlpY4CZO8cWCNm4ZP6BJ4MAAJ2k=
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.8.1.15) Gecko/20080621 SeaMonkey/1.1.10 Mnenhy/0.7.5.0
Xref: news.mathworks.com comp.soft-sys.matlab:489969



Hi,

when I enter

y = 1;
f = @(x)(x+y);
save foobar f;

in the MATLAB command window, the resulting foobar.mat will load and 
work when copied to another computer.

When I execute the same code inside a function and copy foobat.mat, 
MATLAB on the other computer needs the m-file containing the function 
where I defined the function handle "f" to load foobar.mat.

What can I do to change this?

Christian