Message Boards Message Boards

GROUPS:

Select every N elements from a list?

Posted 3 years ago
2310 Views
|
3 Replies
|
2 Total Likes
|

I have a list of 1601 pairs of data (first is frequency in MHz, the second a phase error in degrees)

{{50.`, 0.21774563818642534`}, {54.34375`, 
  0.5304496217442711`}, {58.6875`, 0.5617827847178187`}, {63.03125`, 
  0.3362751440490217`}, {67.375`, 0.36882671665883704`}, {71.71875`, 
  0.4179775194472266`}, {76.0625`, 0.4506475692931553`}, {80.40625`, 
  0.44205688305458546`}, {84.75`, 0.4239454775684832`}, {89.09375`, 
  0.5143533696508089`}, {93.4375`, 0.41519057609652066`}, {97.78125`, 
  0.46836711367956685`}, {102.125`, 0.4502529991528945`}, {106.46875`,
   0.3330082492484374`}, {110.8125`, 
  0.43159288067712076`}, {115.15625`, 0.3956569101288583`}, {119.5`, 
  0.3787603542725497`}, {123.84375`, 
  0.24663322975607915`}, {128.1875`, 
  0.3767055532063148`}, {132.53125`, 0.4010673412291048`}, {136.875`, 
  0.5575086104092817`}, {141.21875`, 0.2823093773106544`}, {145.5625`,
   0.25466965847600864`}, {149.90625`, 0.4643294704271046`}, {154.25`,
   0.32120882966468134`}, {158.59375`, 
  0.401957752668447`}, {162.9375`, 0.27812625589707984`}, {167.28125`,
   0.2817343557882319`}, {171.625`, 0.1825520}}

I want to obtain the start at the 4th element, then drop every 9, so I get the 4th, 14th, 24th,34th etc element.

Any suggestions how to do this?

3 Replies

Part over a Range

Part[theData, Range[4, Length[theData], 10]]

Part over a Span

theData[[4 ;; Length[theData] ;; 10]]

Part on a Partition

Partition[Drop[theData, 3], UpTo[10]][[All, 1]]
Posted 3 years ago

Try...

Take[thedata, {4, Length[thedata], 10}]

Where "thedata" is your list of values...

Posted 3 years ago

Try...

Take[thedata, {4, Length[thedata], 10}]

Where "thedata" is your list of values...

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract