How do I convert a text file which has one row of XY co-ordinate data into two separate columns?
Afficher commentaires plus anciens
I am a novice with MATLAB. I have hundreds of text files (named Data1.txt, Data2.txt, Data3.txt etc...) that have XY co-ordinate data of the form:
X0 Y0 X1 Y2 X3 Y3 X4 Y4 ...
There are 400 sets of X-Y co-ordinates per text file. Each data entry is in a separate column (e.g. In Excel for example, X0 would be in cell A1, Y0 is in cell B1 and so on), but all data is in the same row.
Is there a way of converting the data from its current format into two columns, one for X co-ordinate and other for corresponding Y co-ordinates? (By co-ordinates I mean simply numbers only)
i.e
X1 Y1
X2 Y2
X3 Y3
After this I would then like to export the columned data as a new text file (I will be concatenating all text files into one file for ArcMAP implementation. Can this be done in MATLAB?)
Thank you
Réponses (1)
Ingrid
le 15 Juil 2015
read in all the data from the row and then you will have a column vector you could then use
rowData = reshape(A,2,[]);
columnData = rowData';
2 commentaires
Rogomyster
le 15 Juil 2015
Ingrid
le 16 Juil 2015
if the solution works for you could you please accept the answer? Thank you.
Catégories
En savoir plus sur Text Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!