03-10-2011 09:19 AM
Hi...
I have an 1D array ( array size 8041). How I can creat an array subset/ delete elements from the array. I need to keep every 4th element. The new 1D array size will be 2010.
I need the element from every 4th index.............. 0, (1,2,3), 4, (5,6,7), 8, (9,10,11),12, (13,14,15), 16.........................................,(8037,8038,8039), 8040.
I need to delete the element index in ( ).
xls file is attached
Please help me.
Thanks
03-10-2011 09:29 AM
Do you always need every 4th element or do you need this to be variable during runtime?
If it's fixed, Decimate 1D array is probably the simplest solution.
If the spacing is variable you'll have to use a loop.
03-10-2011 09:34 AM
Have you tried a search? This question has come up more times than I can count and plenty of solutions have been posted, along with variants and performance comparisons. Please do a search, try them out, and then come back if you can't find a solution.
Did you actually try any code? If so, post it, and indicate where you are having problems.
03-10-2011 10:23 AM
Yes I just did the attach coding...........but I am missing the first element
thanks
03-10-2011 10:56 AM
Based on your description you should use the first output array of the decimate function. This will contain elements 0, 4, 8, ...
03-10-2011 12:09 PM
Thanks ....yes ..with first array it is working fine