Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: newbie's question
Date: Wed, 9 Sep 2009 00:41:03 +0000 (UTC)
Organization: Mitre Corp
Lines: 45
Message-ID: <h86tiv$o6m$1@fred.mathworks.com>
References: <74428442-89c6-44e9-a189-eecc7157099b@d15g2000prc.googlegroups.com> <30d585f5-cba6-4433-8721-42273334a29f@m7g2000prd.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1252456863 24790 172.30.248.38 (9 Sep 2009 00:41:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 9 Sep 2009 00:41:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2318
Xref: news.mathworks.com comp.soft-sys.matlab:569115




Mike <sulfateion@gmail.com> wrote in message <30d585f5-cba6-4433-8721-42273334a29f@m7g2000prd.googlegroups.com>...
> On 9&#26376;8&#26085;, &#19979;&#21320;8&#26178;31&#20998;, dpb <n...@non.net> wrote:
> > Mike wrote:
> > > On Sep 8, 10:55 am, dpb <n...@non.net> wrote:
> > >> Mike wrote:
> > >>> Hi
> > >>> I am not familiar with M file.
> > >>> How to group some similar or useful M-file functions together? ?In
> > >>> other programming languages, users usually compile them into a
> > >>> library.
> > >> ML is interpreted, not compiled so don't need to do anything but put the
> > >> collection of m-files in a directory in the working path.
> >
> > >> Once debugged, if speed is an issue, then one can create mex files which
> > >> are compiled callable from ML.
> >
> > >> --
> >
> > > But, if I put them in a directory, I might have less chance to use
> > > them again.
> >
> > ??? ?No clue what you're thinking in reality--wherever they are they're
> > in _a_ directory. ?Whether they're on the working search path is the key
> > to accessibility in ML.
> >
> > Read the section in programming w/ m-files on how search order is
> > resolved...
> >
> > --
> 
> thank you. In fact, I had set the Path.
> Is it better to name M-file function a prefix like 'fun_XXX" to
> distinguish with main M file?
> 
> Mike

You can name m-files however you like.
If fun_XXX makes sense to you, go for it!

However, if you name the function m-file fun_XXX, then
the first line of the function m-file should be something like:

function [x,y,z] = fun_XXX(a,b,c)