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

Incorrect

20Size
Leading solution size is 12.
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
 
%%
txt = 'Hello World, from MATLAB' ;
nl  = 5 ;
counts_correct = [0 0 0 1 1 0 0 1 0 0 0 3 0 0 2 0 0 1 0 0 0 0 1 0 0 0];
assert(isequal(nlWords_getCounts(txt, nl),counts_correct))
Error: Evaluation of ' y=arrayfun(@(x) length(regexp(strcat(ans{:}), char(96+x))), 1:26)' failed:
Error using strcat (line 38)
Not enough input arguments.
2
Fail
 
%%
txt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'
nl  = 9 ;
counts_correct = [3 0 3 1 5 0 1 1 0 0 0 1 0 2 1 2 0 2 2 0 2 0 1 0 0 0];
assert(isequal(nlWords_getCounts(txt, nl),counts_correct))
Error: Evaluation of ' y=arrayfun(@(x) length(regexp(strcat(ans{:}), char(96+x))), 1:26)' failed:
Error using strcat (line 38)
Not enough input arguments.
3
Fail
 
%%
txt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'
nl  = 10 ;
counts_correct = [6 0 6 0 3 0 0 3 0 0 0 0 0 0 0 0 0 6 3 3 0 0 0 0 0 0];
assert(isequal(nlWords_getCounts(txt, nl),counts_correct))
Error: Evaluation of ' y=arrayfun(@(x) length(regexp(strcat(ans{:}), char(96+x))), 1:26)' failed:
Error using strcat (line 38)
Not enough input arguments.