Problem 367. Specific Element Count
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)
The comment about NaNs being equal is rather vague, clarify or give a specific example
NaN==NaN gives 0 help me
Use isnan keyword. isnan(NaN) gives 1
This just got lucky on the test suite. It would fail on ecount(1:12,2), for example.
Problem Recent Solvers820
Find the longest sequence of 1's in a binary sequence.
Get the area codes from a list of phone numbers
Project Euler: Problem 8, Find largest product in a large string of numbers
Find the maximum number of decimal places in a set of numbers
More from this Author56
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!