DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Calculator & Variables

Hello,

When calling the calculation for doing the following operation, the message "Ch(0): invalid vector matrix" appears.
Does anyone has any solution? How can I use my variable in the Calculator?
I would like to erase all the negative values from channel 6 of each group respectively (in any proceeding I will have different number of groups,this is why I am using this variables.)



Dim indexgroup,sChnNo, sGrpNo

for indexgroup=1 To GroupCount step 1
Call GroupDefaultSet(indexgroup)
sGrpNo= str(cnoxget(indexgroup,6))
Call FormulaCalc ("Ch('sGrpNo'):=Ch('sGrpNo')+(Ch('sGrpNo')<=0)*NoValue")
sChnNo= str(cnoxget(indexgroup,2))&"-"&str(cnoxget(indexgroup,GroupChnCount(indexgroup)))
Call ChnNovHandle (cnoxget(indexgroup,1),sChnNo,"Delete","xy",1)
next


Thank you!
0 Kudos
Message 1 of 2
(3,265 Views)
Hi Leiabcn,

The formula calculator doesn't know VBS, therefore it is not possible to use VBS variables defined by DIM. But you can use the auxiliary variables L1, L2, ... or R1, R2 ...

Than your script must be modified as follows:

for indexgroup=1 To GroupCount step 1
Call GroupDefaultSet(indexgroup)
L1 = cnoxget(indexgroup,2)
Call FormulaCalc ("Ch(L1):=Ch(L1)+(Ch(L1)<=0)*NoValue")
sChnNo= str(cnoxget(indexgroup,2))&"-"&str(cnoxget(indexgroup,GroupChnCount(indexgroup)))
Call ChnNovHandle (cnoxget(indexgroup,1),sChnNo,"Delete","xy",1)
next

By the way, cnoxget returns the channel number (this is not the channel index) and is from the type integer.

Greetings

Walter
Message 2 of 2
(3,263 Views)