MATLAB: How to store a char array to a single column array and 3 letter values

MATLABvectro

Hi guys
I have a long sequence with 400 chars but it stored as a 10×40 char array. Please help me to find :
(1) how can i concatenate all 10 rows continuously (with 400 chars) and store in another vector ?
(2) how can i store above vector as a single column array and 3 letter values in each cell (as shown in image) ?
So thanks
Untitled-1.jpg

Best Answer

This sultion produces some fake data to work with and then separates it according to your description. Tested. Works.
% Create sample data (char array [10 x 40])
c = char(randi([100,120],10,40));
% Example how to concatenate into 1 row (car array [1 x 400])
cRow = reshape(c, 1, []);
% Example how to concatenate into 1 col (car array [400 x 1])
cCol = reshape(c, [], 1);
% Create columnar cell array of [1 x 3] strings

% Note that 400 chars are not divisible by 3 so first we'll trim
% any extra values at the end.
cTrim = c(1: floor(numel(c)/3)*3);
% Create [n x 3] char array
chArray = reshape(cTrim, [], 3);
% Create columnar cell array of [1 x 3] strings
cArray = cellstr(chArray);