Thread Subject: newbie's question

Subject: newbie's question

From: Mike

Date: 8 Sep, 2009 02:18:27

Message: 1 of 9

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.

Any suggestions are very welcome. Thank you very much in advance.

Mike

Subject: newbie's question

From: dpb

Date: 8 Sep, 2009 02:55:44

Message: 2 of 9

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.

--

Subject: newbie's question

From: Mike

Date: 8 Sep, 2009 04:53:53

Message: 3 of 9

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.

Mike

Subject: newbie's question

From: Bruno Luong

Date: 8 Sep, 2009 06:54:02

Message: 4 of 9

Mike <sulfateion@gmail.com> wrote in message <cbf50515-54f9-42d9-ac5e-fef0750d7eb0@h40g2000prf.googlegroups.com>...
> On Sep 8, 10:55?am, dpb <n...@non.net> wrote:

>
> But, if I put them in a directory, I might have less chance to use
> them again.
>

You need to add the directory in the search path in order to use them everywhere.

Bruno

Subject: newbie's question

From: dpb

Date: 8 Sep, 2009 12:31:49

Message: 5 of 9

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...

--

Subject: newbie's question

From: Mike

Date: 9 Sep, 2009 00:18:21

Message: 6 of 9

On 9月8日, 下午8時31分, 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

Subject: newbie's question

From: someone

Date: 9 Sep, 2009 00:41:03

Message: 7 of 9



Mike <sulfateion@gmail.com> wrote in message <30d585f5-cba6-4433-8721-42273334a29f@m7g2000prd.googlegroups.com>...
> On 9月8日, 下午8時31分, 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)

Subject: newbie's question

From: Mike

Date: 9 Sep, 2009 01:50:29

Message: 8 of 9

"someone" <someone@somewhere.net> wrote in message <h86tiv$o6m$1@fred.mathworks.com>...
>
>
> Mike <sulfateion@gmail.com> wrote in message <30d585f5-cba6-4433-8721-42273334a29f@m7g2000prd.googlegroups.com>...
> > On 9月8日, 下午8時31分, 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)
thanks.
Mike

Subject: newbie's question

From: dpb

Date: 9 Sep, 2009 02:06:00

Message: 9 of 9

Mike wrote:
...
> Is it better to name M-file function a prefix like 'fun_XXX" to
> distinguish with main M file?

Read the 'Function Names' section on m-file programming in the "Using
Matlab/Programming" chapter...

--

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
general path fo... Sprinceana 8 Sep, 2009 04:23:21
add to path Sprinceana 8 Sep, 2009 04:23:21
m file Sprinceana 8 Sep, 2009 04:22:57
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com