DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in expression: Wrong data type for actual parameter

error data type.jpg

Hi everyone!

 

I  want to use Dasylab to collect some data from a device through a RS232 module.

There are 2 types of Intput Signal. One is started with "A" and the other one is started with "B". And I have already set these two Signals into String 1 and 2. (use fomular "A" a $1 \r) Now I want to seperate these String into different variables. An example is showed below.

string1: 861200  into Variable1: 86  Variable2: 1200

I use the Expression in the variable property setting. The formular is:  strval (substr (${STR_1} ,3 , 4) )

It works well in my simulation program. But when I write this small program with my main program, it shows some error. The screenshot ist linked to this subject. Al the setting are same. I am so confused. Can somebody help me?? I  will very appreciate that.

 

Best wishes,

Hartmut 

0 Kudos
Message 1 of 6
(4,656 Views)

You said, in the other thread,


Hi CJ,

I  want to use Dasylab to collect some data from a device through a RS232 module.

There are 2 types of Intput Signal. One is started with "A" and the other one is started with "B". And I have already set these two Signals into String 1 and 2. (use fomular "A" a $1 \r) Now I want to seperate these String into different variables. An example is showed below.

string1: 861200  into Variable1: 86  Variable2: 1200

Version of DASYLab is 2016 Basic


Can you post the worksheet? Hopefully, the Global String will be saved with some data.

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 6
(4,638 Views)

Sorry I can't, because the main program is not allowed to be uploaded. But I can say that the setting in the main program is exactly same as I have posted. Can you tell how to check if the Global String will be saved with some data. Thank you so much!!

0 Kudos
Message 3 of 6
(4,634 Views)

If you cannot send the full program, do a print screen of the Define Global Strings dialog showing that string.

Usually, the values in the strings and variables are saved with the worksheet when you save. 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 4 of 6
(4,632 Views)

%.png6.png1.png

0 Kudos
Message 5 of 6
(4,621 Views)

Hello CJ,

I think I have find where the problem is.

When I used StrVal (SubStr (${STR_1} ,3,4)), “STR_1” is the error.

When I used StrVal (SubStr (${STR_2} ,3,4)), “STR_2” is the error.

When I used StrVal (SubStr (${STR_3} ,1,4)), “1” is the error.

When I used StrVal (SubStr (${STR_3} ,3,2)), “2” is the error.

When I used StrVal (SubStr (${STR_3} ,3,4)), there is no error any more.

So, I think the error is 1 and 2. I cannot use these two numbers.

0 Kudos
Message 6 of 6
(4,587 Views)