help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-file will only return one variable


From: Jason Martin
Subject: Re: M-file will only return one variable
Date: Wed, 10 Mar 2010 17:49:56 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

When I call a function with multiple returns, I have to call it as:

[var1, var2] = functionname(variables);

Ok, I see now.

Thanks James.

Jason

On 3/10/2010 5:01 PM, James Sherman Jr. wrote:
How are you calling the function?  If you're calling it as

[retrad, retang] = chebtran(ZL,Z0,Gm,NumSec);

and you say that only one variable is returned, does that mean retang is empty?  As far as I can tell, there isn't anything wrong in the syntax of your function.

James

On Wed, Mar 10, 2010 at 4:51 PM, Jason Martin <address@hidden> wrote:
Good afternoon list,

    I am working on a small set of m-files for my microwave circuits
class and I am trying to return one answer in two different formats.  My
m-file is:

function [retrad, retang] = chebtran(ZL,Z0,Gm,NumSec)

pr0 = log(ZL/Z0);

pr1 = acosh((1/0.1)*(pr0));

pr2 = cosh((1/NumSec)*(pr1));

pr3 = asec(pr2);

pr4 = pr3*180/pi;


retrad = pr3;

retang = pr4;

endfunction


    My issue is, only one variable is returned.  In the current order,
I will get the radian answer, retrad, but not the angle answer, retang.
But if I put retang first, I will only get the angle and not the
radian.  According to the manual this should be correct, but I cannot
figure out why I am not getting both answers to return properly.

    Thanks in advance for any help.

Jason
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]