1.

The sum function will return a NaN if any of the element in the input vector is NaN.(a) True(b) FalseThe question was asked in an interview for job.My doubt stems from Sums and Products in portion Beyond the Basics of MATLAB

Answer»

Correct answer is (b) False

For explanation I WOULD SAY: We can write ‘omitNaN’ within the sum function so that while computing sum, the function IGNORES every NaN element present within the INPUT vector.

Eg: A=[1,2,NaN];sum(A,’omitNaN’)- This will return 3 as answer.



Discussion

No Comment Found

Related InterviewSolutions