1.

If the program demands evaluation of multiple, only decimal, values of the same function, what is the better way amongst the following?(a) Using anonymous functions or inline functions(b) Using str2func(c) Using private functions(d) Using any functionThis question was addressed to me by my college professor while I was bunking the class.Enquiry is from Functions in chapter MATLAB Basics of MATLAB

Answer»

The correct answer is (b) Using str2func

Easy explanation: The function str2cat() returns FLOATING point or decimal expressions for INTEGER values or fractional values. Anonymous FUNCTIONS and inline return decimal values for fractional values but not for integer values. HENCE, str2cat is PREFERABLE.



Discussion

No Comment Found

Related InterviewSolutions