MATLAB: How to create character arrays via a loop

character array

I have a list of files in a folder that I access through the "dir" command. Then I use:
gg=cellstr(char({files(1:end).name}));
for i = 1:length(files)
name{i}=gg{i}(1:13);
end
This gives me a cell array with each of the file names of datasets as shown below:
I want to append the word "Sensor 1, Sensor 2, Sensor 3,…,Sensor 38" to each of these file names. So, that I get a cell array that looks like this:
2012-01-30 00 Sensor 1
2012-01-30 00 Sensor 2
………
2012-01-30 01 Sensor 1
……..
2012-01-30 23 Sensor 1
and so on.
How do i do this?

Best Answer

cellstr(reshape((string(name) + " Sensor " + (1:38)).', [], 1))