MATLAB: Help with splitting a string into a character array.

arrayarrays

Let's say I have a string s='Potato'.
How would I split that up into an array so that it looks like t='P, o, t, a, t, o'?
I'm currently doing it like this:
%%Choose word
word=datasample(wordbank,1)
%identify length of word
wordlength=strlength(word)
sol = split(word,"")
The only problem with doing it this way is that there are two blank spots and the beginning and end of the character array. It looks like this when outputted:
"" "P" "o" "t" "a" "t" "o" ""
How can I split it so that the blank values at the beginning and end aren't there?

Best Answer

You could use
s = 'Potato';
t = num2cell(s)
t =
1×6 cell array
{'P'} {'o'} {'t'} {'a'} {'t'} {'o'}