Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Solution 121721

Submitted on 1 Aug 2012

Incorrect

15Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
assert(isequal(ecount(1:10,2),1))
Error: Output argument "ans" (and maybe others) not assigned during call to "/users/msssystem17/ecount.m>ecount".

	    	
2
Fail
 
%%
assert(isequal(ecount([1 1 1 1 1 1 1 1],1),8))
Error: Output argument "ans" (and maybe others) not assigned during call to "/users/msssystem17/ecount.m>ecount".

	    	
3
Fail
 
%%
assert(isequal(ecount([1 1 1 1 1 1 1 1],2),0))
Error: Output argument "ans" (and maybe others) not assigned during call to "/users/msssystem17/ecount.m>ecount".

	    	
4
Fail
 
%%
assert(isequal(ecount([1 1 1 1 NaN NaN 1 1],NaN),2))
Error: Output argument "ans" (and maybe others) not assigned during call to "/users/msssystem17/ecount.m>ecount".

	    	
5
Fail
 
%%
assert(isequal(ecount([15 13 6 2 71 -5 -7 15],15),2))
Error: Output argument "ans" (and maybe others) not assigned during call to "/users/msssystem17/ecount.m>ecount".