cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.
  • See how to access JMP Marketplace - and - find, create & share add-ins to extend your JMP. Watch video.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
robust1972
Level IV

remove few items from a list using script

hi, everyone

I have a list like below and I wrote this script trying to remove items from a list using script which start with ".", but it reports error :"subscript range in access or evaluation of 'subscript', CSV_File_list[i]

=N Items(CSV_File_list);

(NOF);

(CSV_File_list);

(i=1,i<=NOF,i++,

(Starts With(CSV_File_list[i], "."),

Remove From(CSV_File_list, i),

);

CSV_File_list = {"FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_04_BBOCN023SAG0_20150319-155848.csv", ".FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_20150319-155445_04_BBOCN023SAG0_20150319-155848_20150319-171700.csv", "FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_11_BBOCN016SAG7_20150319-171703.csv", ".FAB8_gf_MPW14011MA.A0_8XYL45155.049_A6-SRTOTPROM-14LPE.01_OTPROMMPW1401-SORT_20150319-155445_11_BBOCN016SAG7_20150319-171703_20150319-183919.csv"};


1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: remove few items from a list using script

As items are removed from the the list they get fewer than "NOF" and eventually i will exceed the current number of list items.

To avoid this, remove from the end:

For(i = NOF, i > 0, i--, ...)

View solution in original post

1 REPLY 1
ms
Super User (Alumni) ms
Super User (Alumni)

Re: remove few items from a list using script

As items are removed from the the list they get fewer than "NOF" and eventually i will exceed the current number of list items.

To avoid this, remove from the end:

For(i = NOF, i > 0, i--, ...)

Recommended Articles