Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Skipping numbers in lists in Mathematica

  1. May 1, 2006 #1

    I am new to mathematica, and part of the program I have to write includes reading a file and manipulating the data for research. This file has around 22,000 numbers listed in it. I've already figured out how to look at those numbers and generate a histogram. However, what if I want to skip over numbers, meaning that now I want to read every 256th number until the end of my data set and save it each time under the same name, i.e data1, so I can generate a new histogram with these numbers. I've already tried the takedata option, without much luck.

    I'd appreciate any help.
  2. jcsd
  3. May 1, 2006 #2


    User Avatar
    Science Advisor
    Gold Member

    One simple way to do it would be to write a For [ ] - loop over your data with the appropriate incrementation and writing the operation (the save) in the body of the for-statement.
  4. May 21, 2006 #3
    Okay, I figured out how to skip numbers by using a Do loop.

    Here's my code so far...

    However, I need to evaluate this 256 times where initobs = 1,2...256. I tried to put this whole expression in a do loop, so that it could output 256 different list for different values of initobs, but it doesn't work. What am I doing wrong?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Skipping numbers lists Date
Mathematica Number of extensions with Free Trial of Mathematica Nov 6, 2017
Mathematica Number and location of minima May 11, 2017
Mathematica How to use Switch with variable number of terms? Mar 18, 2017
Maple Maple - Explicit Set Definition & Natural Number Symbol Oct 31, 2016
Mathematica issue: Skip a loop step in Table Apr 19, 2010