How to get cell string array data and combine it as a 1 column only?

Hi, Community
i have a question. I have 2 cell string array data like this :
replika_fix_menitan =
1×2 cell array
{1440×31 string} {1440×30 string}
And actually, i want to grab the data inside of those two cell string array and combine them in just 1 column because each of cell array contains with this kind of data :
Columns 29 through 31
"00:00:00" "00:00:00" "00:00:00"
"00:01:00" "00:01:00" "00:01:00"
"00:02:00" "00:02:00" "00:02:00"
"00:03:00" "00:03:00" "00:03:00"
"00:04:00" "00:04:00" "00:04:00"
"00:05:00" "00:05:00" "00:05:00"
......... ......... ...........
I want to make the 1 - 31 column (in the first cell string array) and the 1 - 30 column (in the second cell string array) become 1 column instead. (the data is time series / duration type with same length in each column). So anyone, would you help me out in finding this solution? Thank you very much /.\ /.\ /.\

Respuestas (1)

Chris
Chris el 31 de Oct. de 2021
Editada: Chris el 31 de Oct. de 2021
I'm going to guess you want a 1440x61 string array.
stringArray = [replika_fix_menitan{:}]
would give you the array. The {:} returns everything inside each cell, and the square brackets collect it all into a new string array, if the dimensions of the arrays inside each cell are compatible.
stringArray = {[replika_fix_menitan{:}]}
would put the array inside a new cell.

4 comentarios

Yes Sir. I wanna combine them into 1440x61 and then convert it to become 87840x1 because i wanna sort them in just 1 column.
Chris
Chris el 31 de Oct. de 2021
Editada: Chris el 31 de Oct. de 2021
stringColumn = reshape([replika_fix_menitan{:}]),[],1);
Or, to go row by row, you can transpose the array before reshaping:
stringColumn = reshape([replika_fix_menitan{:}]'),[],1);
Thats awesome... Great, Sir. Its work. Thank you so much.
Great! feel free to "accept" this answer, then.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

el 31 de Oct. de 2021

Editada:

el 31 de Oct. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by