how to remove the first 5 characters from a cell array 343x1 cell
Mostra commenti meno recenti
Hello all, I would like to remove the first few characters from every single cell (343), yet I am not much aware of how to do it. I tried to solve the problem via googling it yet could not find anything that would fit my case. The cell array is attached. Example: for "d035-117" for instance i would like to convert it into a form of "117". The first 5 characters need to be truncated. Thanks for your advices and help in advance!
2 Commenti
Jack
il 7 Dic 2022
Do you have the answer already, because i don't get it too?
Image Analyst
il 7 Dic 2022
@Jack you can see he accepted my answer below so I guess it worked for him.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Risposta accettata
Più risposte (1)
Jos (10584)
il 27 Ott 2015
Modificato: Jos (10584)
il 27 Ott 2015
If A is your cell-array of strings, this oneliner will do the job:
B = cellfun(@(x) x(1:end-5), A, 'un', 0)
2 Commenti
NU_YU
il 27 Ott 2015
Leone Campos
il 5 Gen 2023
For those who are wondering what 'un' is, it stands for 'UniformOutput'.
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!