strtrim not working pls help me
Three years late here, but strtrim removes both leading and trailing white spaces. The test here is for the trailing scenario only.
Three and a bit years late too, but there may be a bigger problem with strtrim here, which is that apparently strtrim does not remove "null characters" (whether leading or trailing). This wasn't specifically required by the problem statement, but judging by test 3 it is needed here, and thus it seems that strtrim is especially unsuitable for test 3 (cf. Solution 1393480).
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
%%
x = 'MATLAB ';
y_correct = 'MATLAB';
assert(isequal(white_space_removal(x),y_correct))
Error: Undefined function or variable 'cx'.
|
2 | Fail |
%%
x{1,1} = 'MATLAB ';
x{1,2} = 'SIMULINK ';
x{2,1} = 'Toolboxes ';
x{2,2} = 'MathWorks ';
y{1,1} = 'MATLAB';
y{1,2} = 'SIMULINK';
y{2,1} = 'Toolboxes';
y{2,2} = 'MathWorks';
assert(isequal(white_space_removal(x),y))
Error: Undefined function or variable 'cx'.
|
3 | Fail |
%%
NL = char(0);
TAB = char(9);
x = [NL 32 TAB NL 'AB' 32 NL 'CD' NL 32 TAB NL 32];
y = [NL 32 TAB NL 'AB' 32 NL 'CD'];
assert(isequal(white_space_removal(x),y))
Error: Undefined function or variable 'cx'.
|
given 3 sides, find area of this triangle
680 Solvers
546 Solvers
464 Solvers
314 Solvers
184 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!