Cody

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

Created by Peng Liu in Community

String array and cell array are two types of containers for storing pieces of data. In this problem, you will be given a cell array of character vectors. Your job is to convert the cell array to a string array, which stores the same pieces of text data.

To begin with, let's assume that there are no missing type values in the input cell array.

Example:

Input:
>> x = {'I','Love','MATLAB'}
x =
  1×3 cell array
    'I'    'Love'    'MATLAB'
Output:
>> y = strings(size(x));
>> [y{:}] = x{:}
y = 
  1×3 string array
    "I"    "Love"    "MATLAB"

Note that the example shown above is not the best way to solve this problem. Try other approaches in order to achieve a leading score.

Related Problems in this series:

Solution Stats

84.72% Correct | 15.28% Incorrect
Last solution submitted on Jan 24, 2019

Recent Solvers51

Suggested Problems

More from this Author43

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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!