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
 Origin Forum
 Origin C creating X values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zknauss

USA
72 Posts

Posted - 09/20/2022 :  3:54:52 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Using origin C script I need to create a sheet indexing the row number of entries in each column of another worksheet. I've included a picture of what I'm trying to accomplish via the script.

Thanks!

https://www.dropbox.com/s/vy4ca623y8i664v/Capture.PNG?dl=0
https://www.dropbox.com/s/4b5oflskd4i71j8/Capture2.PNG?dl=0

ZTK

zknauss

USA
72 Posts

Posted - 09/21/2022 :  10:14:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So I think for this the Xvalue() function should work I've written the following script but its giving an x index of a column # instead of going column by column and creating a x index of each used row. I tried rewriting it to see the full colomn but it just produces an error or I get really crazy outputs.

for (int i = 1; i <= wks.ncols; i++ ) { range xx = YData!$(i) ; wcol(i)[1] = Xvalue(i,xx) }




ZTK
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/21/2022 :  5:50:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I don't really understand what you are trying to do, but I tried XValue function and it works as expected.

I setup a worksheet named "YData" and it has A(x) B(y), and I put some values into A(x), then the following code

i = 2;
range rr = YData!wcol(i);
for(int ii = 1; ii < 4; ii++) {
	x = xvalue(ii, rr);
	x = ;
}

generated the correct values in A(x).

CP
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/22/2022 :  11:25:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
What I'm trying to do it manually create a peak index so that I can perform a spacific statistical test that is using the peak # as its X value. What I need the code to do is say if in column 1 of my Y data I have 2 entries (two peaks/rows of data) column 1 in a sheet named peak index will display a 1 in row one and a 2 in row two. Then it will move to column 2 repeat this process. The number of peaks in my data sets can vary from two to several hundred so it needs to be dynamic.

ZTK

Edited by - zknauss on 09/22/2022 11:34:26 AM
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/22/2022 :  11:42:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Alternitivly if theres a way of using a row # in a function or math formula, such as wcol(i)[#] = total((row#-#)^2), that would also work.

ZTK
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 09/22/2022 :  12:56:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

for(ii=1;ii<4;ii++) {
  wcol(3)[ii]=total(col(A)[ii:ii+1]);
}


Something like this?

CP
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/22/2022 :  1:10:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
No sorry if anyting thats a lot harder lets stick to just creating a peak index page. I have about 35 equations which need to utilize the peak index number I'd prefer not to recode everything and just buld the page if possible.

ZTK
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/23/2022 :  09:32:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
what is the i or ii < 4 for shouldn't this be i<= "#rows containing a value"? I have 649+ columns with 1-250+ rows used per column so my goal is to do this automatically with no user input

ZTK

Edited by - zknauss on 09/23/2022 09:34:43 AM
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/23/2022 :  09:50:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok I'm really close The below script works for the first column but then it directly copies the "Y" data for every column then after.

for (int i = 1; i <= wks.ncols; i++ ) { range yy = [NCONT1Peak]"Center Max"!$(i); wcol(i) = xof(yy); }

ZTK
Go to Top of Page

zknauss

USA
72 Posts

Posted - 09/23/2022 :  10:01:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Figured it out had to set all the columns as "Y" should be all set!

ZTK
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