How do I convert a text file which has one row of XY co-ordinate data into two separate columns?

2 Ansichten (letzte 30 Tage)
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

Antworten (1)

Ingrid
Ingrid am 15 Jul. 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';

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by