Problem 367. Specific Element Count
29.42% Correct | 70.58% Incorrect
Last Solution submitted on Mar 29, 2023
Swati Sarangi on 5 Nov 2020
The below code fails for the input:
assert(isequal(ecount([1 1 1 1 NaN NaN 1 1],NaN),2))
Can anyone show me the error?
function ct = ecount(v,e)
Peter Corke on 7 Jun 2018
The comment about NaNs being equal is rather vague, clarify or give a specific example
Harish Maradana on 13 Jul 2014
NaN==NaN gives 0 help me
Xiangbing Jiao on 11 May 2019
Use isnan keyword. isnan(NaN) gives 1
Tim on 14 Mar 2013
This just got lucky on the test suite. It would fail on ecount(1:12,2), for example.
Problem Recent Solvers825
Check if number exists in vector
More from this Author56
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!