Is it possible to reference an array of inline functions or function handles created within a structure in MATLAB?
Show older comments
Is it possible to reference an array of inline functions or function handles created within a structure in MATLAB?
The following example demonstrates this problem:
f1 = inline('sin(x)');
f2 = inline('cos(x)');
h.f(1) = f1;
I now calculate
h.f(pi/2)
ans =
1
But if I define:
h.f(2) = f2
I get
h =
f: [1x2 inline]
Now I try to calculate inline results:
h.f([pi/2;pi/2])
I receive the error
??? Comma separated list must have exactly one item.
How can I reference the index of the vector of the inline functions, as well as pass an argument?
Accepted Answer
More Answers (0)
Categories
Find more on Function Creation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!