0

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.

1 Answer 1

1

Write

output = doSomething();

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

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

to display it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.