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
 loop over selected worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

olsy

29 Posts

Posted - 09/19/2011 :  09:06:21 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5Pro
Operating System:Win7

Hi guys!
Got a problem: i have a several worksheets in one workbook and number of worksheets can be different. So i need to find a mean value and standard deviation for columns 5-10 in worksheets starting from second and finish before two last...and put results to a specified column in last worksheet.

Who has any idea?

Penn

China
644 Posts

Posted - 09/20/2011 :  03:03:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Maybe you can refer to the following steps:

1. Get the workbook, you can use the WorksheetPage constructor by passing workbook name.

2. Loop all layers contained in the workbook by Layers collection. Then create the worksheet by passing the layer to the Worksheet constructor. You can use the foreach statement.

3. Get Columns collection from worksheet, and then get column data by GetDataObject method. The result vector contains the data for calculating the mean and standard deviation.

4. Calculate the mean and standard deviation by using ocmath_basic_summary_stats function.

5. Put the results to worksheet by SetCells method.

Hope the steps help.

Penn
Go to Top of Page

olsy

29 Posts

Posted - 09/21/2011 :  11:55:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

Thanks Penn!
I manage to figure out how to loop over worksheets but now i dont understand how to select columns from 5 till 10 and make basic statistics for each of them...it is confusing me.
ive tried SetRange but it is wrong i guess.

How does it work?
Go to Top of Page

Penn

China
644 Posts

Posted - 09/21/2011 :  9:21:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please focus on step 3, 4, and 5. Also, an example, which I have told in this thread before, can be referred to. If you want to combine columns from 5 to 10 as one dataset to calculating mean and standard deviation, you can refer to the vector class to handle the vectors derived from step 3.

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