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

Solution 84899

Submitted on 2 May 2012 by Matt Baran

Correct

12Size
Leading solution size is 10.
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
Pass
 
%%
x = 'MATLAB      ';
y_correct = 'MATLAB';
assert(isequal(white_space_removal(x),y_correct))

                    
2
Pass
 
%%
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))

                    
3
Pass
 
%%
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))