Cody

# Problem 43663. Combine the first and last names

Solution 1184438

Submitted on 9 May 2017
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
firstnames = string({'Donald';'Hillary'}); lastnames = string({'Trump';'Clinton'}); y_correct = string({'Donald Trump';'Hillary Clinton'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

2   Fail
firstnames = string({'Bill','Hillary'}); lastnames = string('Clinton'); y_correct = string({'Bill Clinton','Hillary Clinton'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

Assertion failed.

3   Fail
firstnames = string({'Donald';'Barron';'Eric'}); lastnames = string('Trump'); y_correct = string({'Donald Trump';'Barron Trump';'Eric Trump'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

Error using horzcat Dimensions of matrices being concatenated are not consistent. Error in fullname (line 2) y = join([firstnames,lastnames]); Error in TestPoint3 (line 4) assert(isequal(fullname(firstnames,lastnames),y_correct))

4   Fail
firstnames = string('Mike'); lastnames = string({'Tyson','Pence','Trout'}); y_correct = string({'Mike Tyson','Mike Pence','Mike Trout'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

Assertion failed.

5   Fail
firstnames = string({'Donald','Hillary';'Mike','James'}); lastnames = string({'Trump','Clinton';'Pence','Bond'}); y_correct = string({'Donald Trump','Hillary Clinton';'Mike Pence','James Bond'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!