DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I store different values of the same variable?

Hello,
 
Does anybody know whether it is possible to use variables in a script and store these values in a table.
Normally this isn't hard to do but I want to do the following:
 
The variables are calculated. Then the averages are calculated. I want to store these averages in a table and then delete the variables in the script again. So far I accomplished this by using a do....loop.
However at this point I got the same variables calculated with other files, so I got other values. I also want to store these in the same table, does anyone know this.
 
Robert 
0 Kudos
Message 1 of 2
(3,145 Views)

Hello Robert!

To tell the truth I'm not sure that I understand your problem. Assuming that your 'table' is what DIAdem call a 'channel' and thinking back to your last post I will try to help you.

You have to implement a loop over all your files. This can be done with a do...loop. I prefer a for...next loop if I know the loop count. In the loop you have to calcualte your average. To store the result in a channel you have to allocate one before your loop with the command ChnAlloc. In the loop you can use the Chd command to store the value in a row indexed via the loop counter.

To give you a idea here a sample script:

Dim i
Dim nCount
 
nCount = 10 ' Loop count
 
Call ChnAlloc("MyAverageChn",nCount)
 
For i=1 To nCount
  ' add average calcualtion with result in R1 here
  Chd(i,"MyAverageChn") = R1
Next

Feel free to ask again if this was not the solution

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 2
(3,133 Views)