rearranging txt file in matlab

1 回表示 (過去 30 日間)
Mayowa
Mayowa 2015 年 3 月 27 日
編集済み: Thorsten 2015 年 3 月 27 日
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

回答 (1 件)

Thorsten
Thorsten 2015 年 3 月 27 日
編集済み: Thorsten 2015 年 3 月 27 日
D = textscan(fopen('test.txt'), '%f');
% format to rows with N=26 values
N = 26;
D = reshape(D{1}, [], N);

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by