1
$\begingroup$
s = Import["Directory/FileName.xlsx"]
ListLinePlot[s[[1]], AxesLabel -> {"Time", "Voltage"}]

The graph is some sine wave but it outputs a huge number of lines going out from x=1 instead. My FFT gives a sensible output so this probably isn't a data import issue.

I've tried this on two different computers and I get identical outputs. I would like to know how to resolve this issue and out of curiosity, why it is happening

Graph

$\endgroup$
2
  • 2
    $\begingroup$ What if you use s[[1, All, ;; 2]]? I ask because s is n x m x 3 instead of n x m x 2. $\endgroup$
    – Kuba
    May 1, 2018 at 8:34
  • $\begingroup$ What does ListPlot give? It might be that the points are not in proper order, so ListLinePlot tries to connect the wrong points. Could you also check if ListLinePlot works for the first few points? $\endgroup$ May 1, 2018 at 10:07

1 Answer 1

4
$\begingroup$

As Kuba mentioned it seems like you have n x m x 3 instead of n x m x 2. To simulate this

ListLinePlot[{Table[{t, Cos[π t/0.0001],}, {t, 0, .001, 
 0.00001}]}[[1]]

note the extra comma included after the cosine. This gives you something similar to yours:

enter image description here

without the extra comma:

ListLinePlot[{Table[{t, Cos[\[Pi] t/0.0001]}, {t, 0, .001, 
 0.00001}]}[[1]]]

enter image description here

to achieve this you can as suggested run:

ListLinePlot[s[[1, All, ;; 2]]]
$\endgroup$
1
  • $\begingroup$ Thanks, this resolves the problem. Looks like my data format is erroneous $\endgroup$ May 1, 2018 at 12:57

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.