How do I convert a text file which has one row of XY co-ordinate data into two separate columns?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Ingrid
2015년 7월 15일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!