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:
Subfunctions

Subject: Subfunctions

From: Sam Grayson

Date: 9 Apr, 2009 04:23:01

Message: 1 of 3

I've been trying to understand them, but I don't...at all.

I was looking over the example in lecture 10 and I don't even know what it's doing.

I'm not sure how the subfunction (or subfunctions) interact with the parent function and what variables go where.

Subject: Subfunctions

From: Image Analyst

Date: 9 Apr, 2009 04:30:03

Message: 2 of 3

"Sam Grayson" <samgrayson2@hotmail.com> wrote in message <grjt75$7jd$1@fred.mathworks.com>...
> I've been trying to understand them, but I don't...at all.
>
> I was looking over the example in lecture 10 and I don't even know what it's doing.
>
> I'm not sure how the subfunction (or subfunctions) interact with the parent function and what variables go where.
-------------------------------------------------------
Yes, and . . . . . .
It's a lot like every other programming language out there.
Do you have a question?

Subject: Subfunctions

From: Steven Lord

Date: 9 Apr, 2009 13:55:23

Message: 3 of 3


"Sam Grayson" <samgrayson2@hotmail.com> wrote in message
news:grjt75$7jd$1@fred.mathworks.com...
> I've been trying to understand them, but I don't...at all.
>
> I was looking over the example in lecture 10 and I don't even know what
> it's doing.
>
> I'm not sure how the subfunction (or subfunctions) interact with the
> parent function and what variables go where.

The MATLAB documentation includes a section on "Types of Functions":

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f4-62416.html

Subfunctions are one of the types of functions described in that section.

Commonly, subfunctions interact with each other and with the primary
function in the file by being called with some set of input arguments and
returning some set of output arguments. The big difference between a
primary function and a subfunction is that subfunctions are only "visible"
(in scope, callable) to functions in the file, while primary functions are
more broadly visible.

--
Steve Lord
slord@mathworks.com

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