Cody

# Problem 43674. String Array Basics, Part 3: Convert Cell Array with Missing Values to String Array

Solution 3757413

Submitted on 21 Nov 2020
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   Fail
x = {'I','love','MATLAB'}; y_correct = string({'I','love','MATLAB'}); assert(isequal(cell2str(x),y_correct))

x = 3×1 cell array {'I' } {'love' } {'MATLAB'} y = 1×9 string array "I" "love" "MATLAB" <missing> <missing> <missing> <missing> <missing> "love"

Assertion failed.

2   Fail
x = {'I', '', '', 'MATLAB'}; y_correct = string('I'); y_correct(4) = 'MATLAB'; assert(isequaln(cell2str(x),y_correct))

x = 4×1 cell array {'I' } {0×0 char} {0×0 char} {'MATLAB'} y = 1×9 string array "I" <missing> <missing> "MATLAB" <missing> <missing> <missing> <missing> <missing>

Assertion failed.

3   Fail
x = {'I', '', 'MATLAB' '', 'love', 'MATLAB' 'I', 'love', '' }; y_correct = [string('I'), string(NaN), string('MATLAB') string(NaN), string('love'), string('MATLAB') string('I'), string('love'), string(NaN) ]; assert(isequaln(cell2str(x),y_correct))

x = 3×3 cell array {'I' } {0×0 char} {'I' } {0×0 char} {'love' } {'love' } {'MATLAB'} {'MATLAB'} {0×0 char} y = 1×9 string array "I" <missing> "MATLAB" <missing> "love" "MATLAB" "I" "love" <missing>

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!