I'm not advanced in Mathematica but I'm trying to get better.

I have a big set of Data and I want to Plot the first row against the other ones. I tried to set the Rows into a list and run a "do loop" over all Rows.

My Code :

Data = Import["file", "Table"];
Time = Table[1/60 i, {i, 0, 1430}];
Rows[k_] = Do[List[Transpose[{Time, Data[[All, k]]}]], {k, 1, 16}]
Toplot = Do[Transpose[{Time, Rows[k]}], {k, 1, 16}];

I would be grateful for some help and tips.

  • 6
    $\begingroup$ You should provide a sample of the Data :) $\endgroup$ – Öskå Jul 22 '14 at 9:15
  • 1
    $\begingroup$ Have a look at Part and Span. You will most likely not need a loop at all. Useful: mathematica.stackexchange.com/questions/3069/… $\endgroup$ – Yves Klett Jul 22 '14 at 10:44
  • $\begingroup$ as a fundamental issue your Do loops should be Tables. The posted answer is better of course. $\endgroup$ – george2079 Jul 30 '14 at 12:31

First of all, you should avoid using variables names with capital letters : these correspond to built-in functions.

Then, if I understood correctly, you want to plot the rows of your data versus time. If so, the following code should work :

data = Import["file", "Table"];
time = Range[0, 143/6, 1/60];
ListPlot[Transpose[{time, #}] & /@ data]

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.