cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

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