Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab Architecture Question - Creating Modules in Matlab

Subject: Matlab Architecture Question - Creating Modules in Matlab

From: Pat Finder

Date: 27 Jul, 2009 18:14:02

Message: 1 of 2

I am interested in hearing ideas about the best ways to create "modules" in matlab?

The goal is to have one interface, where I can easily switch routines, and have different versions of the routine run.

For example, suppose I have a routine to recognize license plates. It needs to be initialized, and then on subsequent calls it needs to be run.

Later one, I want to swap the license plate recognition file, with another one, and have the new one take effect.

Is there an established 'best practice' for this in Matlab?

- Pat

[ I'm upgrading to Matlab 2009a, from 2005<something>. ]

Subject: Matlab Architecture Question - Creating Modules in Matlab

From: Doug Schwarz

Date: 27 Jul, 2009 18:52:06

Message: 2 of 2

In article <h4kqpa$l9r$1@fred.mathworks.com>,
 "Pat Finder" <pfinder@netacc.net> wrote:

> I am interested in hearing ideas about the best ways to create "modules" in
> matlab?
>
> The goal is to have one interface, where I can easily switch routines, and
> have different versions of the routine run.
>
> For example, suppose I have a routine to recognize license plates. It needs
> to be initialized, and then on subsequent calls it needs to be run.
>
> Later one, I want to swap the license plate recognition file, with another
> one, and have the new one take effect.
>
> Is there an established 'best practice' for this in Matlab?
>
> - Pat
>
> [ I'm upgrading to Matlab 2009a, from 2005<something>. ]


Hi "Pat",

One way to do this would be to manipulate the MATLAB path -- removing
the directory with the old routine and adding the directory with the new
one.

You could also do it with function handles:

  function_to_use = @function1;

  y1 = function_to_use(x);

  function_to_use = @function2;

  y2 = function_to_use(x);

but with this you have to give the two functions different names since
they will both be on the path at the same time.

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Tags for this Thread

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.

Contact us