5.0

5.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 2.18 KB File ID: #6755

Temporary (or anonymous) function handles for ML 6

by Nathan Thern

 

19 Jan 2005 (Updated 28 Jan 2005)

Creates a temporary function m-file and returns a handle to it.

| Watch this File

File Information
Description

The anonymous function handle feature of ML 7 is a long-needed feature, and one that I have longed for since I began writing scripts in early ML 6.

Unfortunately, I am still forced to use ML 6 most of the time, so I came up with a way to create "psuedo-anonymous" function handles: that is, function handles to real m-file functions that are created on the spot and will be deleted in the near future.

TMP_HANDLE writes out a temporary function m-file in its private subdirectory and then returns a handle to it. As a side effect, it searches for old temporary function files and deletes them.

I have TMP_HANDLE set to delete temporary function m-files that are older than 30 days. The whole idea of cluttering up a subdirectory with little m-files is distasteful, but not really a big deal given modern disk sizes. I have chosen to live with it.

Next step:
Make TMP_HANDLE a class with overloaded feval and subsref so you can call
feval(t_hndl,x,y)
OR just
t_hndl(x,y)

Matlab 5 has feval and classes with overloading, so making tmp_handle a class should allow it to work with ML 5.

MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
02 Mar 2006 Yuri Gribov

Nice work (unfortunately not working in Matlab 7, solution 1-ZW3RB). I think that TMP_HANDLE may be useful even in Matlab 7 because @'s are still significantly slower than normal M-files.

Please login to add a comment or rating.
Updates
28 Jan 2005

Improved the documentation

Tag Activity for this File
Tag Applied By Date/Time
development environment Nathan Thern 22 Oct 2008 07:39:53
anonymous Nathan Thern 22 Oct 2008 07:39:53
function Nathan Thern 22 Oct 2008 07:39:53
handle Nathan Thern 22 Oct 2008 07:39:53
handles Nathan Thern 22 Oct 2008 07:39:53
tmp_handle Nathan Thern 22 Oct 2008 07:39:53
utilities Nathan Thern 22 Oct 2008 07:39:53

Contact us at files@mathworks.com