0
$\begingroup$

This question already has an answer here:

This question is asked quite often but none of the answers I found seem to do what I want.

I have a list

MyList={0., 0.03, 0.125, 0.25, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.5, 1.6, 1.8,
2., 2.2, 2.4, 2.6, 2.8, 3., 3.2, 3.4, 3.5, 3.6, 3.8, 3.9, 4., 4.2,
4.4, 4.6, 4.8, 5., 5.2, 5.4, 5.6, 5.8, 6., 6.2, 6.4, 6.6, 6.8, 7.,
7.2, 7.4, 7.6, 7.8, 8., 8.2, 8.4, 8.6, 8.8, 9., 9.2, 9.4, 9.6, 9.8,
10., 10.5, 11., 11.5, 12., 12.2, 12.5, 13., 14., 15., 16., 17., 18.,
19., 20., 21., 21.5, 22., 22.1, 23., 24., 25., 26., 27., 28., 29.,
30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 40.5, 41.,
42., 42.5, 43., 44., 44.5, 45., 46., 46.5, 47., 48., 49., 50., 51.,
51.5, 52., 53., 53.5, 54., 55., 55.5, 56., 57., 57.5, 58., 59., 59.5,
60., 61., 62., 63., 64., 65., 66., 67., 68., 69., 70., 71., 72.,
72.5, 73., 74., 75., 76., 77., 78., 79., 80., 81., 82., 83., 84.,
85., 86., 87., 88., 89., 90., 91., 92., 93., 94., 95., 96., 96.5,
97., 97.5, 98., 98.25, 98.5, 98.75, 99., 99.25, 99.5, 99.75, 100.}

which are x coordinates of my ListPlot[] that will follow soon. The y coordinates of the mentioned upcoming Lisplot[] is this list

values={383.679, 195.662, 132.98, 97.4587, 76.0955, 61.8225, 51.6127,
43.9374, 37.9574, 33.1641, 29.2363, 25.9596, 23.1876, 20.8115,
18.755, 16.9596, 15.3804, 13.9845, 12.7428, 11.6342, 10.6416,
9.74997, 8.94815, 8.22648, 7.5767, 6.99146, 6.46622, 5.99535,
5.03202, 4.33927, 3.88679, 3.65732, 3.61019, 3.54266, 3.43872,
3.26071, 3.11822, 3.00692, 2.92223, 2.86018, 2.81711, 2.78907,
2.77229, 2.76693, 2.76292, 2.76249, 2.76754, 2.78489, 2.81164,
2.84628, 2.88789, 2.93585, 2.98957, 3.04863, 3.11273, 3.18155,
3.25484, 3.33244, 3.41413, 3.50159, 3.59637, 3.69827, 3.8072,
3.92316, 3.98369, 4.04597, 4.17555, 4.24287, 4.31183, 4.45462,
4.52843, 4.60379, 4.75925, 4.83924, 4.92077, 5.08819, 5.2614,
5.44015, 5.62426, 5.71829, 5.81357, 6.00784, 6.10678, 6.20686,
6.41046, 6.51388, 6.61839, 6.83041, 6.93792, 7.04636, 7.26597,
7.37707, 7.489, 7.71527, 7.94452, 8.17651, 8.41104, 8.64786, 8.88673,
9.12745, 9.36978, 9.61348, 9.85835, 10.1042, 10.3507, 10.4741,
10.5977, 10.845, 11.0924, 11.3397, 11.5866, 11.8754, 12.2488,
12.7079, 13.2553, 13.894, 14.628, 15.4621, 16.4013, 17.4506, 18.614,
19.893, 21.2831, 22.7735, 24.3387, 25.9356, 27.4979, 28.935, 30.1362,
30.9949, 31.2676, 31.4271, 31.5099, 31.5561, 31.5671, 31.5694,
31.5664, 31.558, 31.5445, 31.5279, 31.5094, 31.49}

Now the lists don't have the same length. Actually Length[MyList] - Length[values] turns out to be 28.

This means that In order to use Transpose[] and than ListPlot[] the data I have to somehow delete the first 28 elements from the list MyList. The best I could come up with is using Delete[] and For[] loop

For[i = 1, i¸ <= 28, i++, Delete[MyList, i]]

But this (surprisingly) does absolutely nothing - if I print out MyList after that order, the list is the same...

So, what can I do?

$\endgroup$

marked as duplicate by C. E., Szabolcs, LLlAMnYP, rhermans, Sjoerd C. de Vries Aug 19 '15 at 9:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ Drop, Part, Take, etc. $\endgroup$ – Sektor Aug 19 '15 at 9:04
  • 5
    $\begingroup$ I tagged it as a duplicate of the question mentioned above because of this answer. You have your required solution in Sektor's comment, e.g. MyList = MyList[[29;;]]. $\endgroup$ – C. E. Aug 19 '15 at 9:14
  • 5
    $\begingroup$ Just a hint to better understand why there's nothing surprising here. If you type in C++ or some other language Print[a + 1], you would not expect the value of variable a to change, would you? In your case (and I absolutely do not ever ever endorse or encourage this coding style in MMA) you should have tried For[i = 1, i¸ <= 28, i++, MyList = Delete[MyList, i]] $\endgroup$ – LLlAMnYP Aug 19 '15 at 9:36
  • $\begingroup$ Please consider taking the tour. Your question may be put on-hold because it is a duplicate and it has already been answered and it can be easily found in the documentation. Please don't be discouraged by that cleaning-up policy. Your questions are and will be most welcomed. Learn about good questions here. $\endgroup$ – rhermans Aug 19 '15 at 9:45
  • 1
    $\begingroup$ Specifically this answer of the pitfalls questions applies here. $\endgroup$ – Sjoerd C. de Vries Aug 19 '15 at 9:59
4
$\begingroup$

I am sure this is just repeating one of the many answers previously given to this common question.

 xvals = 
   {0., 0.03, 0.125, 0.25, 0.4, 0.6, 0.8, 1., 1.2, 1.4, 1.5, 1.6,
    1.8, 2., 2.2, 2.4, 2.6, 2.8, 3., 3.2, 3.4, 3.5, 3.6, 3.8, 3.9, 4.,
    4.2, 4.4, 4.6, 4.8, 5., 5.2, 5.4, 5.6, 5.8, 6., 6.2, 6.4, 6.6, 
    6.8, 7., 7.2, 7.4, 7.6, 7.8, 8., 8.2, 8.4, 8.6, 8.8, 9., 9.2, 9.4, 
    9.6, 9.8, 10., 10.5, 11., 11.5, 12., 12.2, 12.5, 13., 14., 15., 
    16., 17., 18., 19., 20., 21., 21.5, 22., 22.1, 23., 24., 25., 26., 
    27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 
    40., 40.5, 41., 42., 42.5, 43., 44., 44.5, 45., 46., 46.5, 47., 
    48., 49., 50., 51., 51.5, 52., 53., 53.5, 54., 55., 55.5, 56., 57.,
    57.5, 58., 59., 59.5, 60., 61., 62., 63., 64., 65., 66., 67., 68.,
    69., 70., 71., 72., 72.5, 73., 74., 75., 76., 77., 78., 79., 80., 
    81., 82., 83., 84., 85., 86., 87., 88., 89., 90., 91., 92., 93., 
    94., 95., 96., 96.5, 97., 97.5, 98., 98.25, 98.5, 98.75, 99., 
    99.25, 99.5, 99.75, 100.};

yvals = 
  {383.679, 195.662, 132.98, 97.4587, 76.0955, 61.8225, 51.6127,43.9374, 37.9574, 
   33.1641, 29.2363, 25.9596, 23.1876, 20.8115, 18.755, 16.9596, 15.3804, 13.9845, 
   12.7428, 11.6342, 10.6416, 9.74997, 8.94815, 8.22648, 7.5767, 6.99146, 6.46622, 
   5.99535, 5.03202, 4.33927, 3.88679, 3.65732, 3.61019, 3.54266, 3.43872, 3.26071, 
   3.11822, 3.00692, 2.92223, 2.86018, 2.81711, 2.78907, 2.77229, 2.76693, 2.76292, 
   2.76249, 2.76754, 2.78489, 2.81164, 2.84628, 2.88789, 2.93585, 2.98957, 3.04863, 
   3.11273, 3.18155, 3.25484, 3.33244, 3.41413, 3.50159, 3.59637, 3.69827, 3.8072, 
   3.92316, 3.98369, 4.04597, 4.17555, 4.24287, 4.31183, 4.45462, 4.52843, 4.60379, 
   4.75925, 4.83924, 4.92077, 5.08819, 5.2614, 5.44015, 5.62426, 5.71829, 5.81357, 
   6.00784, 6.10678, 6.20686, 6.41046, 6.51388, 6.61839, 6.83041, 6.93792, 7.04636, 
   7.26597, 7.37707, 7.489, 7.71527, 7.94452, 8.17651, 8.41104, 8.64786, 8.88673, 
   9.12745, 9.36978, 9.61348, 9.85835, 10.1042, 10.3507, 10.4741, 10.5977, 10.845, 
   11.0924, 11.3397, 11.5866, 11.8754, 12.2488, 12.7079, 13.2553, 13.894, 14.628, 
   15.4621, 16.4013, 17.4506, 18.614, 19.893, 21.2831, 22.7735, 24.3387, 25.9356, 
   27.4979, 28.935, 30.1362, 30.9949, 31.2676, 31.4271, 31.5099, 31.5561, 31.5671, 
   31.5694, 31.5664, 31.558, 31.5445, 31.5279, 31.5094, 31.49};

ListLogPlot[Thread[{xvals[[;; Length @ yvals]], yvals}]]

plotenter image description here

$\endgroup$

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