MATLAB talk:Inline Function
Jump to navigation
Jump to search
- Can arguments put in to the inline function be functions themselves or do they have to be defined numbers?Yd31 11:48, 25 January 2012 (EST)
- The items in the first argument can include functions. The second argument and beyond need to be variable names. But you can certainly have something like which uses the function
c = inline('sqrt(a.^2+b.^2)', 'a', 'b')
sqrt
as a part of the inline. Also, when calling the function, you can have functions that return values - for example:which would return the three values of the function for the single value of the first argument matched against the three values of the second.DukeEgr93 13:35, 25 January 2012 (EST)MyVal = c(cos(pi/6), sin([1 2 3]*pi/6))
- The items in the first argument can include functions. The second argument and beyond need to be variable names. But you can certainly have something like