I am working in an experimental data analysis, the equipment I used handed me the data in txt. format, to import to Mathematica I used the following:

data = Import[

xrdata = Partition[StringSplit[data], 2]

which does give me the list of pairs I wanted, but I cannot plot this, I tried ListPlot, but it only shows and empty plot.

My .txt file has this formenter image description here


Can you try this:

  data= Import["/Users/gustavocustodio/Downloads/debyescherrertable.txt","TSV"]/. 
      s_String :> ToExpression[s];

This will get rid of strings. You can do the partition if you need it. I don't have access to your data

  • $\begingroup$ I tried it, Mathematica says it is not a valid format. I edited my question to show my data. Thanks $\endgroup$ Mar 15 '20 at 23:41
  • $\begingroup$ But I did not used the TSV option, nevertheless I used the last s_String :> ToExpression[s];and it worked, can you explain why does it works and it did not before? $\endgroup$ Mar 15 '20 at 23:45
  • $\begingroup$ It's with how the strings are placed. You can import as a dat and TSV and analyze. $\endgroup$
    – Rupesh
    Mar 15 '20 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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