The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Reduce data table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

MaxImai89

Germany
2 Posts

Posted - 11/11/2018 :  12:25:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Edited by - MaxImai89 on 11/11/2018 12:30:45 PM

nick_n

Finland
125 Posts

Posted - 11/11/2018 :  2:15:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

MaxImai89

Germany
2 Posts

Posted - 11/11/2018 :  3:08:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Nick,
thanks a lot for your answer. It is working now.

Best wishes.
Max
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000