Why am I only getting one output when I run my Matlab function with 2+ outputs?

  • Thread starter Thread starter eurekameh
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 2K views
eurekameh
Messages
209
Reaction score
0
I'm having trouble getting two outputs. Here's a simple example:

function [a b] = test2()
a = 2;
b = 5;

When I run the code, I only get the output of a = 2:
>>test2
ans =
2

How can I get b outted as well?
 
Physics news on Phys.org
Comma is also not working.
 
Sorry, I forgot to add, call the function like so:

[apple,orange] = test2()

since it returns multiple outputs.