Author |
Topic  |
|
kimahri01
5 Posts |
Posted - 01/09/2018 : 09:48:16 AM
|
Origin Ver. 2016(64 bit) and Service Release b9.3.226 Operating System: Windows 10
Hi I am Kim. I have some problem with background subtraction. I have read this topic https://www.originlab.com/forum/topic.asp?TOPIC_ID=9797 and I tried to modify a script but it did not work.
I have column A to I. I set A as X and the others are Y. My background is column D. I want to subtract background(column D) to column B to H. So I adjust the code to
for(ii=2;ii<=wks.ncols;ii++) wcol(ii)=wcol(ii)-col(4);
However, when I run this code, it subtracted column B to D only. It did not subtract the column after D. I do not know about the code well. Could you please give me a suggestion?
Another question is I cannot use peak analyzer theme for batch processing with using existing dataset for the background. I understood that I have to fix the data set for an only active worksheet to be a background. So when I use this to another worksheet, it failed. How could I do that for background subtraction without a script for batch processing for many worksheets imported as mentioned above?
Thank you
|
|
Drbobshepherd
USA
Posts |
Posted - 01/09/2018 : 2:28:01 PM
|
When your loop gets to ii=4, your routine zeroes the background array, Col(4). Then the rest of the loop subtracts zero from the remaining arrays, so it looks like the loop stopped. Store your background array in Col(2), and start your loop with Col(3).
DrBobShepherd |
 |
|
kimahri01
5 Posts |
Posted - 01/09/2018 : 11:53:45 PM
|
Dear Drbobshepherd
Thank you very much. I got it. |
 |
|
Drbobshepherd
USA
Posts |
Posted - 01/19/2018 : 09:17:15 AM
|
Kim,
Now that you have your background subtraction script working correctly, you can use it for batch processing. There are many ways to do this. I like entering scripts in an import filter, if possible. This approach will execute your script every time you import a data file. (This works most easily if your data files have a unique extension. Unique file extension usually means a unique filter, and Origin can automatically apply it. If more than one filter exists for your files, you will be prompted to choose).
Read the help files on how to create a custom import filter. It will save time. Then batch processing could simply(and quickly) be done by dragging your data file icons from MS Windows Explorer over to the Origin workspace. It is called Drag and Drop. Look it up.
DrBob |
 |
|
|
Topic  |
|
|
|