Problem 44808. Make an anonymous function that has variable output
Solution Stats
Problem Comments
-
1 Comment
Very interesting topic... glad be part of this multi-output discussion.
Solution Comments
-
3 Comments
Wow...never thought this one also do the trick. Awesome!
Why does str2num work for anonymous function?
Don't be confused by the name "str2num", which might give you a wrong impression that this function only works for str to number conversion. In fact, it is more powerful because it supports evaluation of any valid string or character represented MATLAB expressions in much the same way eval does. The underlying implementation of str2num is indeed based on eval. Check the documentation and source file for more details.
-
3 Comments
Cheating a bit. I believe test suite need some "try...catch" to prevent such behaviour.
nevertheless, didn't see this coming. never expected that kinda structure would work.
@Jan Orwat, Nice! Everything is changes from star to star.
Problem Recent Solvers15
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
41375 Solvers
-
251 Solvers
-
427 Solvers
-
235 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
1081 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!