I have data.txt. There is lot of numbers, in this format (1.4282E-01, 5.0537E+00, 1.2573E-01, 5.0537E+00, 1.8311E-02, 5.0513E+00,...n) all is in one line.
I need transform:
1.4282E-01, 5.0537E+00,
1.2573E-01, 5.0537E+00,
1.8311E-02, 5.0513E+00,
.
.
.
n
I write this code, but calculate is very long and not end.
data.txt
A=data;
n=643968;
index_i=1:2:n;
index_j=1:1:n/2;
for i=index_i;
j=index_j;
B(j,1)=A(1,i);
end
??? I need A(1,1)=B(1,1); A(1,3)=B(1,2); A(1,5)=B(1,3);
please help me

 採用された回答

Stephan
Stephan 2019 年 3 月 29 日

0 投票

A=[1.4282E-01, 5.0537E+00, 1.2573E-01, 5.0537E+00, 1.8311E-02, 5.0513E+00];
B=reshape(A,2,[])'

その他の回答 (0 件)

カテゴリ

製品

タグ

質問済み:

2019 年 3 月 29 日

回答済み:

2019 年 3 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by