Filter löschen
Filter löschen

rearranging txt file in matlab

2 Ansichten (letzte 30 Tage)
Mayowa
Mayowa am 27 Mär. 2015
Bearbeitet: Thorsten am 27 Mär. 2015
I need help rearranging this data into table in matlab. I want the first row to start from 200.1012 and ends at -999.2555. The next row to start from 200.2536 and ends at -999.2566. It's a large dataset and I will like to rearrange it in such manner. The data is a text file(.txt). I simply want first number (200.1012) to be arranged in such a way that the next vertical number below it is has 200.2536 and so on til it get to the last number on the first row (-999.2555), which has the number vertically below to be (-999.2566). Thanks in advance.
200.1012
-999.2500 4.2655 -999.2500 -999.2500 -999.2500
-999.2500 9.1020 -999.2500 -999.2500 -999.2500
-999.2500 -999.2500 -999.2500 -999.2500 -999.2500
-999.2500 -999.2500 -999.2500 -999.2500 -999.2500
177.0910 -999.2500 444575.0938 6601617.5000 -999.2555
200.2536
-999.2500 4.2655 -999.2500 -999.2500 -999.2500
-999.2500 10.7474 -999.2500 -999.2500 -999.2500
-999.2500 -999.2500 -999.2500 -999.2500 -999.2500
-999.2500 -999.2500 -999.2500 -999.2500 -999.2500
177.2434 -999.2500 444575.0938 6601617.5000 -999.2566

Antworten (1)

Thorsten
Thorsten am 27 Mär. 2015
Bearbeitet: Thorsten am 27 Mär. 2015
D = textscan(fopen('test.txt'), '%f');
% format to rows with N=26 values
N = 26;
D = reshape(D{1}, [], N);

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by