got a range from an array, but looking for other ways of doing it
a is an array. I'm trying to chop the first and last third off. or,
choose only the middle third. can be a rough third.
a.length # 4808
range = a.length * 0.3 # 1442.4
range = range.to_i # 1442
rangetop = a.length / 2 + range # 3846
rangebottom = a.length / 2 - range # 962
a[rangebottom..rangetop].length # 2885
.
Relevant Pages
- Re: "streaming" data
... Perhaps you could chop them up with a text editor before bringing them to ... MATLAB. ... You can even CLEAR the initial array when done w/ it if desired but unless using some other really large memory data structures probably unnecessary. ... (comp.soft-sys.matlab) - Writing with Split
... I have used the Split to chop up a line of text. ... I want to amend one of the datum in the array. ... will I need to re-write the whole line again to the bottom of the file? ... (microsoft.public.dotnet.languages.vb) - Re: strings and text files
... array or structure wherein each line is a separate item within the ... What I would really like to do is to take the first 4 characters of ... I can always chop the lines up later. ... (comp.soft-sys.matlab) - strings and text files
... array or structure wherein each line is a separate item within the ... What I would really like to do is to take the first 4 characters of ... I can always chop the lines up later. ... (comp.soft-sys.matlab) - Re: got a range from an array, but looking for other ways of doing it
... choose only the middle third. ... That's a very rough third:) ... arr =.to_a ... bot = arr.length/3 ... (comp.lang.ruby) |
|