Cody

Problem 44671. find number of times of occurrence of the most frequent number in a row vector

Solution 1627120

Submitted on 13 Sep 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
x =[2 3 3 3 5 3 3 5 5 5 5 5 5]; y_correct = 7; assert(isequal(num_mode(x),y_correct))

ux = 2 3 5 nx = 0 0 0

Unable to perform assignment because the left and right sides have a different number of elements. Error in num_mode (line 5) nx(i) = x==ux(i) Error in Test1 (line 3) assert(isequal(num_mode(x),y_correct))

2   Fail
x =[8 8]; y_correct = 2; assert(isequal(num_mode(x),y_correct))

ux = 8 nx = 0

Unable to perform assignment because the left and right sides have a different number of elements. Error in num_mode (line 5) nx(i) = x==ux(i) Error in Test2 (line 3) assert(isequal(num_mode(x),y_correct))