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
    Hi,

    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

    PerennialII

    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Skipping numbers in lists in Mathematica
  1. Lists in mathematica (Replies: 4)

Loading...