T O P I C R E V I E W |
MaxImai89 |
Posted - 11/11/2018 : 12:25:30 PM OriginPro 2018G SR1, Operating System: Windows 7
Ladies and Gentlemen, I would like to keep only every 10 row in my table. For this purpose, I have tried to write the following script.
// Script
q=%H!wks.maxRows; // get the number of rows q=q+1; int ii2=0; int ii3=0; for(int ii=1; ii<q; ii++) { ii2=ii+1; //that the gap of 10 Values (rows) will be deleted ii3=ii+10; //if(ii3>q){ii=q; ii3=ii2;} wks.deleteRows(ii2,ii3); // delete Rows q=%H!wks.maxRows; // get the number of rows q=q+1; }
// End of the Script
Unfortunately, the values are not removed continuously, i.e. at the end of the table, more values are removed than desired. So it seems as if the distance between the data to be deleted increases quadratically. I would be very happy about your help. |
2 L A T E S T R E P L I E S (Newest First) |
MaxImai89 |
Posted - 11/11/2018 : 3:08:17 PM Hi Nick, thanks a lot for your answer. It is working now.
Best wishes. Max |
nick_n |
Posted - 11/11/2018 : 2:15:46 PM Hi,
It happens since index of next rows changed when you delete every 10 rows in your script.
Solution #1: menu Worksheet -> Reduce Rows If you prefer script, Solution #2: https://www.originlab.com/doc/X-Function/ref/wreducerows
Nikolay |
|
|