octave-maintainers
[Top][All Lists]
Advanced

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

Re: inline functions in Matlab R14


From: Philipp.Batchelor
Subject: Re: inline functions in Matlab R14
Date: Wed, 22 Sep 2004 17:46:43 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

John W. Eaton wrote:
Can someone who has Matlab R14 say what it does in the following
cases?

  inline ('p_1+1')

  inline ('p+q')

  inline ('abc+xyz')

Thanks,

jwe



Here is what I get:(seems meaningful): I removed some empty lines:
'p_1+1' is a function of one variable, others of two variables (complains with 1 input).

-------------------------------
>> version
ans =
7.0.0.19901 (R14)
>> inline ('p_1+1')
ans =
     Inline function:
     ans(p_1) = p_1+1

>>   inline ('p+q')
ans =
     Inline function:
     ans(p,q) = p+q

>>   inline ('abc+xyz')
ans =
     Inline function:
     ans(abc,xyz) = abc+xyz

% and testing:

>> g = inline ('p_1+1')
g =
     Inline function:
     g(p_1) = p_1+1

>> g(1)
ans =
     2

>> g(2)
ans =
     3

>> k = inline ('p+q')
k =
     Inline function:
     k(p,q) = p+q
>> k(1,1), k(pi,exp(1))
ans =
     2
ans =
    5.8599

>> h  = inline ('abc+xyz')
h =
     Inline function:
     h(abc,xyz) = abc+xyz

>> h(1,1)
ans =
     2

>> h(1,2)
ans =
     3
>> l = inline ('Abc+xyZ')

l =

     Inline function:
     l(Abc,xyZ) = Abc+xyZ

>> l(1,pi)

ans =

    4.1416

% and for vector inputs:

>> g([1,1])

ans =

     2     2

>> l([1,1],2)

ans =

     3     3



reply via email to

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