DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Standard Deviation ????

Hi everyone,
I am looking for a better way to calculate the Standard Deviation. Rightnow I am using a DIAdem command called "Call StatBlockCalc(StatOrient, RowNoStr, ChnNoStr)" and im selecting "StatSel(14)" as my return type....using this command im calculating the standard deviation for all the 2nd channel(entire channel data - row wise ) in each data group and populating them into another channel in a different data group....This process is taking very long time to provide me the result...So, could anyone of you provide a better solution which is fast enough.......

Expecting your response......

----Flexxy
0 Kudos
Message 1 of 7
(5,724 Views)
Hi Flexxy,

So you are calculating the standard deviation correctly. As to it taking a long time, since it must run through all the values in the channel as well as all the channels in the separate group, it may be exapected to take some time. If you could tell me how long your channels are and also how many channel groups you have, I may be better able to tell you how long the calculation would be expected to take.

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 2 of 7
(5,708 Views)
Hi Caroline....
The length of each channel would be around 3000 and sometimes more also. Then the channel group may be any number depending upon the user needs , he may select two groups or even 10 groups. I have to calculate both positive and negative Standard Deviation and as well as Mean for all the selected channel group....

Channel consideration for calculation are like this...

Channel Group1
ChanA1
ChanB1
Channel Group2
ChanA2
ChanB2
Channel Group3
ChanA3
ChanB3
:
:
Channel Group n (The last group selected by the user)

So i will be calculating the +3*Standard Deviation for(ChanA1,ChanA2,ChanA3....ChanAn)
and +3*Standard Deviation for (ChanB1,ChanB2,ChanB3....ChanBn)
similarly for -3*std.Deviation and mean calculation........

To do this process with the command i have specified ealier it takes the long time and s I would like to know if there is any alternative for this which saves time.
I am using an user interface to get the user input....

I have also attached the code which i have used to calculate -3*std.deviation.
0 Kudos
Message 3 of 7
(5,706 Views)
Hi Flexxy,

So looking at the size of your channels and also the number of calculations you are doing, I would expect that the calculations would take some time. Again. Im not real sure about how much time you believe is "too long". However, I do not believe that this woudl be a calculation that would happen in just a few seconds.

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 4 of 7
(5,684 Views)

Hello,

 

I have a  problem regarding standard deviation, too. Please give me a hand with it.

I load several channels ( the number may be different all the times) with DataFileLoadSel command, and one of the channels that I load have only one value.

I need to calculate the standard deviation of this channels ( the channels that have only one value "OpForce"), but I don't know how to define the StatBlockCalc command, because on the ChnNoStr field I don't know what to write, to include all the groups with the channel.

The groups are random named ( I don't know why), and for that I do not know the name of the group, only the name of the channels inside.

Attached is  pictured with the data portal and script, to have a better ideea about the task.

 

Thank you for your time,

 

Marius

 

0 Kudos
Message 5 of 7
(5,043 Views)

Hi Marse,

 

According to the VBScript you posted a screenshot of, the names of your Groups are coming from the names of the data files you're loading.  They don't look random to me, but I don't know what files you selected. Regarding the standard deviation calculation, in general the standard deviation of 1 value is either that value itself or undefined.  Do you perhaps mean that you want to calculate the standard deviation of the N single values stored accross the N "OpForce" channels in the various Groups?.  You can calculate with the StatBlockCalc() command "row-wise" accross the values of multiple channels, though I'm not sure if it will let you do that with N channels that just have 1 value each.  If that doesn't work you can create a new channel containing only the values you want to calculate from.  Here's a brief (untested) outline of how to build the channel string of those N channels for the row-wise (Block) standard deviation calculation:

 

ChnStr = ""

FOR iCount = 0 TO UBound(MyFileNames)

  Call DataFileLoadSel(....)

  OpForce = CNoXGet(GroupCount, 4)

  ChnStr = ChnStrAdd(ChnStr, OpForce)

NEXT

 

Call StatBlockCalc("Block", "1", ChnStr)

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 7
(5,035 Views)

 

Thank you Brad,  for your help.

 

 " ChnStr = ChnStrAdd (ChnStr, OpForce)  " it was just what I had needed.

I use your way to load  and name channels and I had build using  StatSel(2) = "Yes" command a new channel.

After that I calculate the standard deviation from the "sum" channel.

 

Thank you for your time and have a good day.

 

Marius

0 Kudos
Message 7 of 7
(5,019 Views)