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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Reduce data table

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000