data from first line to two column

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

 Respuesta aceptada

Stephan
Stephan el 29 de Mzo. de 2019
A=[1.4282E-01, 5.0537E+00, 1.2573E-01, 5.0537E+00, 1.8311E-02, 5.0513E+00];
B=reshape(A,2,[])'

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 29 de Mzo. de 2019

Respondida:

el 29 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by