Message Boards Message Boards

0
|
8031 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

create new data

Posted 10 years ago

Hello, I need to ask the following problem: I have data and 2 points. I need to create a new list where the data at a specified interval. Thank you for your help :)

data={1,2,3,4,5,6,7,8,9} point1=3 point2=7

I need this: newdata=3,4,5,6,7

POSTED BY: martin martin

You want Part using Span notation:

data = {1, 2, 3, 4, 5, 6, 7, 8, 9} 
point1 = 3 ;
point2 = 7;
newdata = data[[point1 ;; point2]]

The last line means "index point1 through point2 of data."

POSTED BY: Jesse Friedman
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