Skip to main content
Post Reopened by rm -rf
added 103 characters in body; edited tags; edited title
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 479

Import numeric data formatinto Mathematica

I have a c++C++ program output the f(x) forthat outputs a set of numbers at each time step. Each time step is separated by a A blank line separates successive time steps. Here is an example of my data format:

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

...

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

I want to import this into the mathematicaMathematica with the following format:

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

Soi.e., the data for each time step will beis in one list. Thanks. How do I do this?

Import data format

I have a c++ program output the f(x) for each time step. Each time step is separated by a blank line.

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

...

I want to import this into the mathematica with format

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

So data for each time step will be in one list. Thanks.

Import numeric data into Mathematica

I have a C++ program that outputs a set of numbers at each time step. A blank line separates successive time steps. Here is an example of my data format:

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

I want to import this into Mathematica with the following format:

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

i.e., the data for each time step is in one list. How do I do this?

added 12 characters in body
Source Link
wei
  • 33
  • 6

I have a c++ program output the f(x) for each time step. Like

Each time step 0:is separated by a blank line.

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

time step 1:

 
0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

... I

I want to import this into the mathematica with format

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

So data for each time step will be in one list. Thanks.

I have a c++ program output the f(x) for each time step. Like

time step 0:

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

time step 1:

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

... I want to import this into the mathematica with format

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

So data for each time step will be in one list. Thanks.

I have a c++ program output the f(x) for each time step. Each time step is separated by a blank line.

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3
 
0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

...

I want to import this into the mathematica with format

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

So data for each time step will be in one list. Thanks.

Post Closed as "Not suitable for this site" by Yves Klett, Artes, Dr. belisarius, Kuba, m_goldberg
Source Link
wei
  • 33
  • 6

Import data format

I have a c++ program output the f(x) for each time step. Like

time step 0:

0.2 42.8
0.4 12.3
0.6 32.1
0.8 37.3

time step 1:

0.2 44.2
0.4 17.8
0.6 39.0
0.8 30.1

... I want to import this into the mathematica with format

data = {
  {{0.2`, 42.8`}, {0.4`, 12.3`}, {0.6`, 32.1`}, {0.8`, 37.3`}},
  {{0.2`, 44.2`}, {0.4`, 17.8`}, {0.6`, 39.`},  {0.8`, 30.1`}}
  };

So data for each time step will be in one list. Thanks.