home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.soft-sys.matlab
- Path: sparky!uunet!stanford.edu!nntp.Stanford.EDU!forsythe.stanford.edu!nova!maurer
- From: Michael Maurer <maurer@nova.stanford.edu>
- Subject: SOURCE: vfeval.m - feval with extra arguments
- Message-ID: <maurer.727750830@nova.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: STAR Lab, Stanford University, California USA
- Date: 23 Jan 93 01:00:30 GMT
- Lines: 53
-
- Hoping to start a trend, here is an unsolicited matlab m-file.
- VFEVAL is like FEVAL but allows extra arguments.
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # vfeval.m
- # This archive created: Fri Jan 22 16:56:12 1993
- export PATH; PATH=/bin:$PATH
- echo shar: extracting "'vfeval.m'" '(547 characters)'
- if test -f 'vfeval.m'
- then
- echo shar: will not over-write existing file "'vfeval.m'"
- else
- sed 's/^XX//' << \SHAR_EOF > 'vfeval.m'
- XXfunction y=vfeval(fun,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)
- XX
- XX%VFEVAL
- XX% y=vfeval(fun,P1,...). Like FEVAL, but allows up to 10 extra
- XX% arguments named P1,P2,...,P10.
- XX% Example:
- XX% y = vfeval('2*sin(P1+P2)',a,b)
- XX
- XX% See FMIN.M for inspiration.
- XX% Michael Maurer, 10 Feb 1992.
- XX% Copyright (c) 1993 by Michael Maurer
- XX
- XXif any(fun<48),
- XX evalstr=fun;
- XXelse
- XX evalstr=[fun, '('];
- XX for argc=1:nargin - 1
- XX if argc>1,
- XX evalstr=[evalstr ','];
- XX end
- XX evalstr = [evalstr,'P',num2str(argc)];
- XX end
- XX evalstr = [evalstr, ')'];
- XXend
- XXy=eval(evalstr);
- SHAR_EOF
- if test 547 -ne "`wc -c < 'vfeval.m'`"
- then
- echo shar: error transmitting "'vfeval.m'" '(should have been 547 characters)'
- fi
- fi # end of overwriting check
- # End of shell archive
- exit 0
- --
- ______________________________________________________________________
- Michael Maurer maurer@nova.stanford.edu (415) 723-1024
-