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
 Origin - Column into Segments
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

chintan

India
16 Posts

Posted - 06/05/2015 :  05:43:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8 SR4, Windows 7,64 bit.

Hi,

I am facing one issue. I have a data set of around 12078 values. I wanted to divide it into different segments with respect to series of data values (irrespective of index number) and put it into different vectors for analysis.

For example, when the value changes from 1.xxxx to 2.xxxx I have to collect it in a vector. I have to do it for all segments(value change from 1.xxx to 2.xxx, 2.xxx to 3.xxx, 3.xxx to 4.xxx etc ...). How should I do it ? Can you please help me with an example code.


Regards,
R.B.Dipu.


cmbhatt

jasonzhao

China
262 Posts

Posted - 06/08/2015 :  03:23:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Please check with the example below:


int groupData(void)
{
Worksheet wks = Project.ActiveLayer();
vector sub0_1, sub1_2, sub2_3;  //vector to save data in range 0~1, 1~2, 2~3
Dataset source;
source.Attach(wks,0); //analysis for column 0
for(int i=0;i<source.GetSize();i++)
{
	int dd=(int)source[i];
	switch(dd){
	case 0:
	sub0_1.Add(source[i]);
	break;
	case 1:
	sub1_2.Add(source[i]);
	break;
	case 2:
	sub2_3.Add(source[i]);	
	break;
	}
}
return 0;
}


Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

chintan

India
16 Posts

Posted - 06/09/2015 :  01:12:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Much thanks Mr. Jason.


cmbhatt
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