Multiple output functions don't work

All my multiple output functions can't work. I install it again, it still can't work.
Please help me,thanks very much.
The code used to be good, I can get multiple answers.
This one is just for test,and my computer simply shows the first answer.
if A = 1, B = 2,the answer is ans = 2
function [C,D] = jiafa(A,B)
C = A+1;
D = B+6
end

1 comentario

Stephen23
Stephen23 el 7 de Oct. de 2019
Editada: Stephen23 el 7 de Oct. de 2019
"All my multiple output functions can't work. I install it again, it still can't work."
Rather than assuming a fault and drastically reinstalling MATLAB, it would be much simpler to just work through the introductory tutorials, which teach very basic MATLAB concepts (such as how to call functions with multiple output arguments):
Or read the function help, which also has examples of multiple outputs:
Or simply use your favorite internet search engine...

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Oct. de 2019
You need to assign to multiple variables if you want to get both the 2 and 8 output.
[first_output, second_output] = jiafa(1, 2)

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Oct. de 2019

Editada:

el 7 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by