DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Channels and variables in SCRIPT

Hi,

 

I am new to Scripting in DIAdem 2014.

I am trying to divide the channel "s_delta_L_R" by a value stored in my variable "track".

But when running the script, I always get the error message "Variable 'track' not defined".

This is my code:

 

dim track

track = 2 'in m

Call Calculate("Ch(""[1]/angle_L_R"")=Ch(""[1]/s_delta_L_R"")",NULL,NULL,"")

Call Calculate( "track=2000" )

Ch("[1]/angle_L_R")=ArcSin( Ch("[1]/s_delta_L_R") / track )

 

Thanks for your help!

 

Jonas

0 Kudos
Message 1 of 3
(2,874 Views)
Dim track
track = 2 'in m
Call Calculate("Ch(""[1]/angle_L_R"")=Ch(""[1]/s_delta_L_R"")",NULL,NULL,"")
Call Calculate("Ch(""[1]/angle_L_R"")=asin(ch(""[1]/s_delta_L_R"")) / " & (track*1000) & "",NULL,NULL,"")

But line 3 seems redundant  

0 Kudos
Message 2 of 3
(2,854 Views)

Thanks a lot! That works great.

It took me a while though to figure out that DIAdem Script doesn't allow to use floating point variables in the "Calculate" function.

The error message always said "Expected end of command" which didn't exactly help 😉

But now that I make sure all variables are rounded to integers before computing, it works perfectly.

Seems like VBS and me are becoming friends after all.

0 Kudos
Message 3 of 3
(2,834 Views)