1
$\begingroup$

I have data as a "dat" file exported from matlab in this format:

   0.0000000e+00   5.0251170e-10
   6.6680005e-02   2.9928438e-08
  1.3336001e-01   3.2211615e-08
  2.0004002e-01   2.5819088e-08
  2.6672002e-01   1.9912510e-07
  3.3340003e-01   1.2164600e-08
  4.0008003e-01   3.3591592e-07
  4.6676004e-01   3.7976813e-07
  5.3344004e-01   1.0210168e-07
  6.0012005e-01   1.1753486e-06
 6.6680005e-01   1.7250708e-07
 7.3348006e-01   1.2378948e-06
 8.0016006e-01   1.9807977e-06
 8.6684007e-01   1.3961595e-07
 9.3352007e-01   4.6064945e-06
 1.0002001e+00   1.3926179e-06
 1.0668801e+00   3.8312722e-06
 1.1335601e+00   1.0100186e-05
 1.2002401e+00   3.2600501e-08
 1.2669201e+00   2.2926305e-05
 1.3336001e+00   1.4471191e-05
 1.4002801e+00   2.0777995e-05
 1.4669601e+00   1.3401266e-04
 1.5336401e+00   4.9475277e-06
 1.6003201e+00   2.5085131e-03
 1.6670001e+00   3.2650080e-03
 1.7336801e+00   9.6810898e-05
 1.8003601e+00   2.0783125e-04
 1.8670401e+00   7.7972426e-06
 1.9337202e+00   4.5902776e-05

But I want to plot them in 2 dimensions as semilog of the second column versus the first one as x axis. but there is letter "e" in data how can remove them and access to correct number to plot them because in this format I can't plot them!!

$\endgroup$

2 Answers 2

3
$\begingroup$

Your snippet of Data in file my.dat and in the same dir a Mathematica file for example 00.nb,

toi = Import["my.dat", "Table"];

See also Import.

If speed is important see OpenRead and ReadList:

moi = OpenRead["my.dat"];
data = ReadList[moi, {Number, Number}];

ListLogPlot[{toi}]

enter image description here

ListLogPlot[{data}, Mesh -> All, 
MeshStyle -> Directive[PointSize[Large], Red], Joined -> True, 
Frame -> True]

enter image description here

$\endgroup$
3
$\begingroup$

You must Import the file using the "Table" format.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.