Cody

Problem 43677. String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

Solution 2991121

Submitted on 25 Sep 2020 by ivan fernandez
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
x = {'I','love','MATLAB'}; y_correct = strings(size(x)); [y_correct{:}] = x{:}; assert(isequal(cell2str(x),y_correct))

sx = 1 3 y = 1×3 string array "" "" "" y = 1×3 string array "I" "" "" y = 1×3 string array "I" "love" "" y = 1×3 string array "I" "love" "MATLAB"

2   Pass
x = {'I', 'love', 'MATLAB' 'I', 'love', 'Cody'}; y_correct = strings(size(x)); [y_correct{:}] = x{:}; assert(isequal(cell2str(x),y_correct))

sx = 2 3 y = 2×3 string array "" "" "" "" "" "" y = 2×3 string array "I" "" "" "" "" "" y = 2×3 string array "I" "love" "" "" "" "" y = 2×3 string array "I" "love" "MATLAB" "" "" "" y = 2×3 string array "I" "love" "MATLAB" "I" "" "" y = 2×3 string array "I" "love" "MATLAB" "I" "love" "" y = 2×3 string array "I" "love" "MATLAB" "I" "love" "Cody"

Community Treasure Hunt

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

Start Hunting!