I used two very simple commands to plot the first data set, and it worked out perfectly:

data = Import["E:\\Hysteresekurve.txt", {"Data", {All}, {2, 3}}];
ListPlot @ data

For my next plot, I imported this txt file into Excel, did the necessary calculations and then exported the spreadsheet to a new txt where the newly calculated data has its own column. Next I tried to plot the new data set with the following commands:

dataTry = 
  Import["C:\\Users\\user\\Desktop\\HystereseMitTab.txt", {"Data", {All}, {3, 6}}];
ListPlot @ dataTry

This returns a blank coordinate system without any data points. If I erase the semicolon after the first line Mathematica returns the list of the points to be plotted without plotting those so I assume something goes wrong whilst plotting and it's not something that came up after the excel export, but I might be wrong.

Googling did not help that much, so I am asking you guys if anyone can help me with this. Relatively new to Mathematica so the problem might have a trivial solution that I am just unable to come up with on my own.

  • $\begingroup$ Posting the data (or putting somewhere like pastebin) would make it easier for people to help. $\endgroup$ Nov 24, 2017 at 10:28
  • $\begingroup$ @NVardan Welcome to Mathematica.SE. Start by taking time to read the FAQ. This site is a collaborative effort, so don't only ask, but also give, by answering questions in your area of expertise. Also important, when you see good Q&A, upvote them, it shows appreciation. And accept the answer which best answers your question. Again, appreciation, but also a sign for others that the problem has been solved. Enjoy. $\endgroup$
    – ubpdqn
    Nov 24, 2017 at 10:29
  • $\begingroup$ @NVardan what does the output of data look like. I suspect there is an issue with the import: e,g. strings, missing values, array shape $\endgroup$
    – ubpdqn
    Nov 24, 2017 at 10:30
  • $\begingroup$ This is the original file, the one that I can plot without any issues: pastebin.com/eQuaK02n This is the one that I have issues with: pastebin.com/iV4K89nu I tried to export as both a text file with tabs and as one with standard unicode-text. Neither version works. $\endgroup$
    – NVardan
    Nov 24, 2017 at 11:09
  • $\begingroup$ @ubpdqn I don't get any error messages hence my confusion. Also, thank you for the welcome. Since I am new to Mathematica, I don't have any areas of expertise so the help I can offer is very limited, however I will try to do my best. $\endgroup$
    – NVardan
    Nov 24, 2017 at 12:36

1 Answer 1


I think the best way is to prepare you data file using Excel or some other software (as suggested by @José Antonio Díaz Navas). If you want to use your original data file you can, for example, import your data using "Table" format and process them a little in Mathematica.

data = Import["hystereseerror.txt", "Table", NumberPoint -> ","][[7 ;;]];
ListPlot@Transpose[{data[[All, 3]], data[[All, 5]]}]

enter image description here

  • 1
    $\begingroup$ Or more simply, ListPlot@data[[All, {3, 5}]] $\endgroup$
    – Bob Hanlon
    Nov 24, 2017 at 21:10
  • 1
    $\begingroup$ Worked perfectly, thank you very much! I did prepare it with excel beforehand because I had to use the data I measured to calculate something before I would plot it, but I guess after exporting the data something did not go as I wanted it to so when I tried to use the original code with the new file and slight modifications it did not work. But your version worked perfectly! Thank you again! Next time I will directly import the spreadsheet into Mathematica, it will probably work out way better! $\endgroup$
    – NVardan
    Nov 24, 2017 at 22:49

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.