I got error "Subscript Range in access or evaluation of 'collist[ /*###*/i]' , collist[/*###*/i]" when doing a simple new column () with increasing for loop. I able to solve it using decreasing for loop. However, I want to have created column ordered follow increasing for loop. I dont understand what causes the error when using increasing for loop here. Can someone provide suggestion how I can use increasing for loop here? if possible, can someone help explain why the error will happen for increasing for loop?
path = "my file path with filename.jmp";
dt= open(path);
collist = dt <<get column names(string);
colname = Column("test1") <<getname;
colnumber = (Loc(collist,colname))[1];
For(i=colnumber+1, i<=Ncols(dt),i++, //give the error
//For(i=Ncols(dt), i>colnumber+1,i--, fixed issue but created column order inverted
dt <<new column("SG_"||collist[i], character);
);