how to call a function

Hi,
I am running a simulation program. in each simulation i have to use a number which i have to generate in a separate function.
The issue for me is can I call a function with out an INPUT and get the output.
Any small example code is highly appreciated!
dav

 Accepted Answer

Andy
Andy on 31 Oct 2013

1 vote

Write the function you need and save it in the active directory or on the path i.e.
function [newnumber] = examplefunction
newnumber = rand;
end
From command window or in other m-file call the function by simply writing: -
x = examplefunction;

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Asked:

dav
on 31 Oct 2013

Commented:

dav
on 31 Oct 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!