Cody

Solution 1742446

Submitted on 4 Mar 2019
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   Pass
A = 'This is a test string. '; y_correct = 'This is a test string.'; assert(isequal(rem_trail_ws(A),y_correct))

A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string.' y = 'This is a test string.'

2   Pass
A = ' Testing function rem_trail_ws'; y_correct = ' Testing function rem_trail_ws'; assert(isequal(rem_trail_ws(A),y_correct))

y = ' Testing function rem_trail_ws'

3   Fail
A = {'MATLAB ','SIMULINK '; 'Toolboxes ','MathWorks '}; y_correct = {'MATLAB','SIMULINK'; 'Toolboxes','MathWorks'}; assert(isequal(rem_trail_ws(A),y_correct))

y = []

Error using cat Dimensions of arrays being concatenated are not consistent. Error in cell2mat (line 83) m{n} = cat(1,c{:,n}); Error in rem_trail_ws (line 5) ce = cell2mat(ce) Error in Test3 (line 5) assert(isequal(rem_trail_ws(A),y_correct))

4   Pass
A = sprintf('MATHWORKS \t'); y_correct = 'MATHWORKS'; assert(isequal(rem_trail_ws(A),y_correct))

A = 'MATHWORKS ' A = 'MATHWORKS' y = 'MATHWORKS'

Suggested Problems

More from this Author29