Mike Smith
Mike Smith

Reputation: 149

Matlab - Access the output a function inside another function

I am trying to access the output of a function from another function. I have the following function:

function f = doSomething
f = 5+6;

In another function I'm calling doSomething as follows:

doSomething;

Is there a way to get the value of f? I want to read the output of doSomething and display it.

Upvotes: 0

Views: 93

Answers (1)

George
George

Reputation: 3845

Write

output = doSomething();

to store the result to the variable "output", and

fprintf('%d\n',output);

to display it.

Upvotes: 1

Related Questions