Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Passing argument to a function in matlab:

Status
Not open for further replies.

barathwaj555

Newbie level 5
Joined
Sep 28, 2010
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
I have used a matlab file named arena.m.. In this file i have used many variables(orientation,centroid...). i have called for 3 matlab files blue.m,yellow.m,black.m from main file arena.m,,,, can u suggest a way to pass arguments to files blue, yellow , black and get back the changed values correctly... is ther anyway to do it without arguments??
 

Hi,

Standard matlab calls are by value (not by reference).
But you can get the modified values as ouputs, for instance you can call the "blue" function like this:

newValueBlue = blue( oldValueBlue );

and the same for the other functions.
Obviously, blue.m must return the new value as output.
Regards

Z
 

i am using a function which should pass all the values to other function. how can i do that??
 

remember you can return multiple results from a Matlab function, e.g. say you have a file swap.m
Code:
function [a, b] = swap(a_in, b_in)
a = b_in;
b = a_in;
end
you can use it so
Code:
x=5
y=10
[x,y]=swap(x,y)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top