How to read pairs of data from a text file?

1 view (last 30 days)
I have a few output text files arranged in one row, each pair of data is (x1,x2) i.e:
-0.00049249 0.000252263 0.000674042 0.000829539 0.000820268 -0.00049555 ...
how can I put it in two columns Xodd Xpar like this:
-0.00049249 0.000252263
0.000674042 0.000829539
0.000820268 -0.00049555
. .
I'm a new user, I'll appreciate any help. Ty in advance

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 9 Feb 2014
Edited: Azzi Abdelmalek on 9 Feb 2014
A=[-0.00049249 0.000252263 0.000674042 0.000829539 0.000820268 -0.00049555]
B=reshape(A,2,[])'
To read your text file you can use dlmread
A=dlmread('your_file.txt')

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!