data from first line to two column

1 次查看(过去 30 天)
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
A=[1.4282E-01, 5.0537E+00, 1.2573E-01, 5.0537E+00, 1.8311E-02, 5.0513E+00];
B=reshape(A,2,[])'

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by