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

Subject: Functions

From: Wen Zhe

Date: 31 Mar, 2010 09:21:04

Message: 1 of 2

Dear all,

How am i able to pass a variable value from one function to another function, which are on different M files?

So let's say i want to pass the variable M containing a value 2 from function 'tot' to function 'pop'. Is this how i define it?

function M = tot (......)

function pop (M)

Let me know. Thanks!¬

Subject: Functions

From: Sadik

Date: 31 Mar, 2010 09:43:04

Message: 2 of 2

Hi Wen,

Yes, this is how you define it.

When you are calling them, you can do:

M = tot(...
pop(M);

or

pop(tot(...

Best.

Tags for this Thread

No tags are associated with 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