MATLAB: Split the given string into characters

data split

I have a column in my table that has values such as '2.6ELKUxQKWPVJVHxxxxC.4xxxIxSxJJxxxxx', it has altogether 37 single characters. I want to split the string into 37 different columns for further data analysis. I have tried using 'split' function, but it doesn't work.

Best Answer

Here's an example for 8 columns. You can expand it to 37 columns.
ca = {'1.6ELKUxQKWPVJVHxxxxC.4xxxIxSxJJxxxxx'; '2.6ELKUxQKWPVJVHxxxxC.4xxxIxSxJJxxxxx'; '3.6ELKUxQKWPVJVHxxxxC.4xxxIxSxJJxxxxx'}
t = cell2table(ca)
% Now we have our table.
% Extract this one column:
col1 = t{:,1}
% Make 37 cell arrays
ca1 = cell(37, 1);
ca2 = cell(37, 1);
ca3 = cell(37, 1);
ca4 = cell(37, 1);
ca5 = cell(37, 1);
ca6 = cell(37, 1);
ca7 = cell(37, 1);
ca8 = cell(37, 1);
for row = 1 : length(col1)
thisRow = col1{row};
ca1{row} = thisRow(1);
ca2{row} = thisRow(2);
ca3{row} = thisRow(3);
ca4{row} = thisRow(4);
ca5{row} = thisRow(5);
ca6{row} = thisRow(6);
ca7{row} = thisRow(7);
ca8{row} = thisRow(8);
end
t2 = table(ca1, ca2, ca3, ca4, ca5, ca6, ca7, ca8)