I have a cell array of strings. It is in two columns. The first column contains whitespace, and I want to split it into multiple columns based on the whitespace. The second column has line breaks I want to remove.
The following function ALMOST gives me what I want:
col1 = arrayfun(@(r) [strsplit(allpacks{r,1})],1:rows,'Uni',0).';
col2 = arrayfun(@(r) regexprep(allpacks{r,2},'[\n\r\f]+',''),1:rows,'Uni',0).';
allpacks = [col1, col2];
col2 is perfect, exactly what I want.
col1, however, is a (rows x 1) cell array of cells, with each cell being a 1x21 cell array of strings. I want col1 to actually be a (rows x 21) cell array of strings. I feel I'm really close, but nothing I've tried works. How can I get what I want here?
Per comment, here is some Example Data from Column 1:
1 2015-09-03 08:02:15.067342000 0.000000000 0.000000000 172.24.2.2 -> 172.24.2.34 Modbus/TCP 64 query: trans: 12289; unit: 42, func: 4: Read Input Registers
I want each "word" in this string to be it's own column in the cell array. Note there are 20 "words" but it comes out to 21 because the initial space ends up getting its own column from strsplit.