We say that I have a function:
  function [A, B, C] = test (X, Y, Z) A = 2 * x; B = 2 * y; C = 2 * z; End    When you press run, matlab output arguments -  [A]  with only the first value in this case. Is there any command that I can put it inside my function which automatically gives all the output output arguments  [A, B, C]  instead of the first argument? I know that I can type windows  [A, B, C] = test (x, y, z)  in my order and get all the values, but I'm lazy, And just run the press and get all the values automatically. 
Some options:
Add a parameter to specify the verbose output console Set it by default:
  function [a, b, c] = test (x, y, z, verbose) if nargin = 3 verbose = false; End; A = 2 * x; B = 2 * y; C = 2 * z; If verbose fprintf ('a =% f \ nb =% f \ nC =% f', a, b, c); End;   or combine them into an output:
  function output = test (x, y, z) a = 2 * x; B = 2 * y; C = 2 * z; Output = [A, B, C]; % // or {A; B; C} if they are not going to the same size, but then it will not display   at the end or if you really want me to think that you can write a cover function Call your function and it shows all three for you that you can use it normally on any function. But this seems hardly worthwhile.
Comments
Post a Comment