Message Boards Message Boards


Import and Plot the following data in a .txt file?

Posted 2 months ago
3 Replies
5 Total Likes

Good night, this question is made because although the existing different post about this thematic, I have not been able to put it into practice. In this moment I have taken measurements of an experiment but I could not visualize them in Mathematica.

Attached a source code of my notebook, and the data in question. Thanks for your attention.

3 Replies

The first step could be to import the file into Mathematica in TSV format and then clean it up a little:

data = Import[
cleanedData = 
  data /. str_String :> ToExpression@StringReplace[str, "," -> "."];
ListPlot[cleanedData[[All, 1 ;; 2]]]

There may be a faster way with SemanticImport, but the default settings do not give directly usable results.

Posted 2 months ago

Thanks so much, this does work, i had not idea that in this format the "," and the ".", generating a problem in my plot design. Again thanks so much for you time and dedication in my question.


Posted 2 months ago

The same can be done with Import. Try:

data = Import["../RespuestaEscalon_A10_k_1.txt", {"TSV", "Data", All, 1 ;; 2}, "NumberPoint" -> ","]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract