- What is a "cell of 1*3430 character"?
- What does "acqusition time for 245 files" exactly mean?
- What is "stored in continuous manner"?
- What is the type and size after "convert it into a column"?
- With which code did you try the trim function?
- What was the error message?
cell of characters to column
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a cell of 1*3430 character consisting of acqusition time for 245 files. (one time value is of 14 charachters stored in continuous manner).
i want to convert it into a column. i tried using trim function but there was some error everytime.
these values would be input to another function so getting these values are essential hence looking for help in this regards.
2 Commenti
Jan
il 16 Mag 2022
The question is not clear:
Please post more details.
Risposta accettata
dpb
il 16 Mag 2022
Modificato: dpb
il 16 Mag 2022
We need to see this in situ -- how did you get it into such a form, first.
Attach the file from whence the data came (or a representative sample thereof) and/or a .mat file of the data.
While it's probably possible to avoid having to do so by reading the data in correctly, if they are fixed-length strings, then
t=cellstr(reshape(s,14,[]).');
will give you an Nx14 cellstr array to pass or convert.
Example, dummy data--
>> s='A':'z'; s=s(1:end-2) % make up a string with mod(14) characters...
s =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx'
>> strlength(s)
ans =
56
>>
Apply the engine...
>> t=cellstr(reshape(s,14,[]).')
t =
4×1 cell array
{'ABCDEFGHIJKLMN'}
{'OPQRSTUVWXYZ[\'}
{']^_`abcdefghij'}
{'klmnopqrstuvwx'}
>>
Più risposte (1)
Voss
il 16 Mag 2022
Modificato: Voss
il 16 Mag 2022
It's not clear whether you have (Case 1) a cell array of characters, like this:
times_cell_char = {'0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '1' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '3' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4'}
Or (Case 2) a cell array of character vectors, like this:
times_cell = {'00000000000000' '00000000000001' '00000000000002' '00000000000003' '00000000000004'};
Or (Case 3) a single character vector, like this:
times_char = '0000000000000000000000000001000000000000020000000000000300000000000004';
It's also not clear what you want the result to be.
If the result should be a character array, you can do one of these things:
Case 1:
times = reshape([times_cell_char{:}],14,[]).'
Case 2:
times = char(times_cell.')
Case 3:
times = reshape(times_char,14,[]).'
If the result should be a (column) cell array of character vectors, you can do one of these things:
Case 1:
times = cellstr(reshape([times_cell_char{:}],14,[]).')
Case 2:
times = times_cell.'
Case 3:
times = cellstr(reshape(times_char,14,[]).')
2 Commenti
dpb
il 17 Mag 2022
@Arvind Gauns, I'd still ask/am curious how you got such data into such a format in the beginning so that you had to split it this way. It would seem could avoid that in the beginning???
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!