Author |
Topic |
|
gleeblejim
USA
33 Posts |
Posted - 05/23/2012 : 3:05:59 PM
|
Origin Ver. 8.6 and Service Release 3 (Select Help-->About Origin): Operating System: Win 7
Hello,
I currently have an opx that will import data into Origin in on one worksheet. I'm trying to create a new template that when the data is imported with do some RMS calculations for me on a second worksheet. In the Command Window I have:
range FRMS = 1!col(force)[3200:4100] //This grabs data from the current workbook from the force column, in rows 3200 to 4100. double force_rms; double noise; force_rms=rms(FRMS-mean(FRMS)*1000; noise=20*log(force_rms);
If I make assign a column in Sheet2 FRMS it grabs all of the data, not just the data in the described rows. Also when I assign a row and column the variable force_rms or noise, I get not data. Any suggestions?
|
|
couturier
France
291 Posts |
Posted - 05/24/2012 : 03:16:50 AM
|
1. first line, semicolon is missing 2. rms(FRMS-mean(FRMS)*1000; there is an unmatched brace
Tip: you can assign a value to a variable in the same line you declare this variable. For example: double noise=20*log(force_rms); |
|
|
gleeblejim
USA
33 Posts |
Posted - 05/24/2012 : 07:46:36 AM
|
Thank you.
Do you know how to properly grab just a span of rows? Every time I use the [3200:4100] it still grabs all of the data. I've even used Origin to grab the variable with the rows I want, and yet I'm still getting all of the data, not just the rows I'm looking for. |
|
|
gleeblejim
USA
33 Posts |
Posted - 05/24/2012 : 11:16:11 AM
|
Sorry about double posting, but I fixed my calculation problems. I'm trying to up my opx so that when the user Imports the data, it calls my template that has the data imported on Sheet1, and Sheet automatically analyzes the data and displays the results. The problem is that whenever it loads the data, it never keeps the second sheet with the calculations. I've tried using "Save Template As" and "Save Workbook as Analysis Template" and neither is working, both remove Sheet2 and display the imported data in sheet1.
Suggestions?
PS Thanks for everyone's help! |
|
|
Penn
China
644 Posts |
Posted - 05/25/2012 : 02:17:23 AM
|
Hi,
I tried a simple test as below:
1. Import the example data, which is "<Origin Install Directory>\Samples\Import and Export\F1.dat". 2. Select column B, and perform frequency count (Statistics: Descriptive Statistics: Frequency Count), which will generate a new worksheet for the results. 3. With the first worksheet (where data will be imported) active, adn save this workbook as analysis template, name here is F1.ogw. 4. The test LabTalk script is
dlgfile;
impASC options.ImpMode:=3 options.Template:=F1.ogw;
When the dialog open, select F2.dat from the same folder with F1.dat.
I can see the frequency count result is shown in the second worksheet for this new imported data. So I cannot really tell what the problem is now, maybe you can send your project, together with the template and opx to technical support, and then we can look further into it. You can click the Send File to Tech Support link in the top-right corner to send us files.
Penn |
|
|
gleeblejim
USA
33 Posts |
Posted - 05/25/2012 : 08:39:59 AM
|
I don't think I'm saving the template with the first sheet as the active. I'll give that a try. |
|
|
gleeblejim
USA
33 Posts |
Posted - 05/25/2012 : 12:21:10 PM
|
Thanks Penn! After changing the Active worksheet before saving the template, it worked. |
|
|
|
Topic |
|