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
 Background substraction origin
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JoannaZajac

United Kingdom
14 Posts

Posted - 10/06/2011 :  08:23:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi, I use Origin 8 and 7 under WINXP,
Ive written a program in a code builder in Origin 8 to subtract background, which is 1 column of the data set, from each column inside big data set,
it is working fine in origin 8, code attached below;
now I want to use this code with Origin 7, and it not supports it,
any comments on how to rewrite it in simple manner that it is going to work under origin 7 are welcome,
thanks

string strBk$ = D21400;
string strSh$ = Sheet1;
range rSh = [strBk$]strSh$!;
range rDa = [strBk$]strSh$!col(cut0y);
loop(ii,4,rSh.nCols)
{
range rDb = [strBk$]strSh$!wcol(ii);
rDb = rDb-rDa;
}


Joanna

Penn

China
644 Posts

Posted - 10/07/2011 :  11:35:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Joanna,

The string and range do not exist in Origin 7, also, the Workbook concept is new since Origin 8, so, your script cannot be executed correctly in Origin 7. If you have activated a worksheet, you can run the following script in Origin 7 to do the same thing.

loop(ii, 4, wks.nCols)
{
	col($(ii)) = col($(ii)) - col(cut0y);
}


Penn
Go to Top of Page

JoannaZajac

United Kingdom
14 Posts

Posted - 10/10/2011 :  08:45:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Penn,
could you tell me if it is possible in LabTalk, Origin7 to access data set from the script(ogs file) by passing dataset as argument in run.file() command?
Thanks,

Joanna
Go to Top of Page

Penn

China
644 Posts

Posted - 10/11/2011 :  06:31:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Joanna,

The run.file() method accepts the file name, but not the dataset. If you want to pass dataset as argument, you can use run.section() method instead. For example, there is an ogs file named Custom.ogs include the following script:

[Main]  // section name
	layer.plotxy(%1, %2);  // accept two argument, %1 and %2

Then, I will assume there is a worksheet named Data1, and there are two columns, A and B in the worksheet. Now, activate a graph window and run the following script:

// pass column A and B to %1 and %2 respectively, so to plot to the layer
run.section(Custom, Main, data1_A data1_B);


Penn
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