Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a list with measured data. There are multiple measurements in the list, but each measurement requires some time to find its equilibrium. I'd like to know the positions of the equilibria, but because of errors (during the measurement and in the behaviour of the measured quantity), I'd like to get five consecutive values from each equilibrium, so I can take the average (or at least compare them). Here is the graph of the data:
picture of data
The useful data can be extracted at the positions used by

data[[450;; ;; 500]]

I know the following will work

Tranpose@Table[data[[445+i;; ;;500]],{i,0,10}]

But I expected the following to work (which it does not sadly)

data[[Range[445,455];; ;;500]]

Can this be done without using Table (or similar constructs)?

share|improve this question

closed as off-topic by Kuba, rm -rf Feb 19 '14 at 9:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, rm -rf
If this question can be reworded to fit the rules in the help center, please edit the question.

Can Partition be useful? –  ybeltukov Jan 20 '14 at 0:52
Could you provide data sample? –  Kuba Jan 20 '14 at 8:37

1 Answer 1

Transpose[data[[# ;; ;; 500]] & /@ Range[445, 455]]

Should fit the bill, though that may fit your 'other construct' description, if you're after something like Matlab 'smart indexing'. If so, it is pretty trivial to write a wrapper to do so.

As alluded to in comments, Partition can be used to effect this, though it's not any 'cleaner', e.g., for your example parameters:

Partition[data[[445 ;; 1455]], 11, 500, 1, {}]
share|improve this answer
I've thought of that, but it isn't really different from Table IMO. It may however speed up things a little bit (right?). –  Ragnar Jan 20 '14 at 0:49
Yes, probably a wash performance-wise. You could partition the range limited list (as alluded to by ybeltukov above), but I don't think there'd be any performance advantage. –  rasher Jan 20 '14 at 1:19

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