how to remove the first 5 characters from a cell array 343x1 cell
Ältere Kommentare anzeigen
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 Kommentare
Jack
am 7 Dez. 2022
Do you have the answer already, because i don't get it too?
Image Analyst
am 7 Dez. 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:
Akzeptierte Antwort
Weitere Antworten (1)
Jos (10584)
am 27 Okt. 2015
Bearbeitet: Jos (10584)
am 27 Okt. 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 Kommentare
NU_YU
am 27 Okt. 2015
Leone Campos
am 5 Jan. 2023
For those who are wondering what 'un' is, it stands for 'UniformOutput'.
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!