Split column data into two columns
Mostra commenti meno recenti
I have a column of data with numbers formatted as a string. All of the 3,000 plus entries are five characters long such as 01234. I would like to split that out into two columns so that one column would be the first two numbers and the other the last three, such as 01 234. I cannot seem to find the right solution for this. Any thoughts?
1 Commento
Kellie Anton
il 3 Ago 2017
Modificato: Kellie Anton
il 3 Ago 2017
Risposte (1)
Honglei Chen
il 2 Ago 2017
Could you elaborate what you have as a matrix?
If you are using character arrays, it should just be a 5-column matrix to start with. So all you need to do is just getting the first 2 columns and then last 3 columns. For example
a = ['01234';'12345']
a(:,1:2)
a(:,3:5)
Does this help?
3 Commenti
Kellie Anton
il 2 Ago 2017
Kellie Anton
il 3 Ago 2017
Honglei Chen
il 3 Ago 2017
maybe you can try
glop = goop{1}(:,1:2)
HTH
Categorie
Scopri di più su Resizing and Reshaping Matrices 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!