Cody

Problem 43663. Combine the first and last names

Solution 2156211

Submitted on 11 Mar 2020 by Swapnil Dongare
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
assessFunctionAbsence('regexp','FileName','fullname.m')

2   Pass
firstnames = string({'Donald';'Hillary'}); lastnames = string({'Trump';'Clinton'}); y_correct = string({'Donald Trump';'Hillary Clinton'}); assert(isequal(fullname(firstnames,lastnames),y_correct))

y = 2×1 string array "Donald" "Hillary" y = 2×1 string array "Donald Trump" "Hillary" y = 2×1 string array "Donald Trump" "Hillary Clinton"

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

y = 1×2 string array "Bill" "Hillary" y = 1×2 string array "Bill Clinton" "Hillary" y = 1×2 string array "Bill Clinton" "Hillary Clinton"

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

y = 3×1 string array "Donald" "Barron" "Eric" y = 3×1 string array "Donald Trump" "Barron" "Eric" y = 3×1 string array "Donald Trump" "Barron Trump" "Eric" y = 3×1 string array "Donald Trump" "Barron Trump" "Eric Trump"

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

y = "Mike" y = "Mike Tyson" y = 1×2 string array "Mike Tyson" "Mike Pence" y = 1×3 string array "Mike Tyson" "Mike Pence" "Mike Trout"

6   Pass
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))

y = 2×2 string array "Donald" "Hillary" "Mike" "James" y = 2×2 string array "Donald Trump" "Hillary" "Mike" "James" y = 2×2 string array "Donald Trump" "Hillary" "Mike Pence" "James" y = 2×2 string array "Donald Trump" "Hillary Clinton" "Mike Pence" "James" y = 2×2 string array "Donald Trump" "Hillary Clinton" "Mike Pence" "James Bond"

Suggested Problems

More from this Author30

Community Treasure Hunt

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

Start Hunting!