LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW MathScript Missing definition variable

My task is to detect the head and end of the frame from a receive massage packet  (1D array), and then store the data in  different array. But the error is:  the variable is not defined in the script,if  the variable is not defined, it is impossible to add output, please help solve it.ThanksMs.PNG

 

0 Kudos
Message 1 of 11
(3,638 Views)

Hi USTC,

 

using pure LabVIEW G it would be so much easier to solve your task than by that cryptic MathScript node!

There's no hassle with "variables" once you use wires!

 

Example:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,634 Views)

Because of the large number and 16 channels, I also thought about using Labview G,for example :Index array but I don't know how to program according to the meaning of the code.Can you give me a hint?

0 Kudos
Message 3 of 11
(3,624 Views)

Look for a data package  from a 1-D array, 

for example: 1-D array data package :  0 0 0 0 A B 1 2 4 5 6 7 8 9 D   A B 2 5 6 8 4 7 2 1  D   A B 1 2 8 9 6 7 8 9 D   A B 1 2 4 7 5 7 2 1 D .....

A  B : Frame header   😧 trailer  

I want to separate the data in the middle of the end of the frame header into different 1D arrays.

Thank you !

0 Kudos
Message 4 of 11
(3,648 Views)

Whether  the length of Date Package is constant.

Simple Logic Will be Index the Start of Data Packet (I1,I2 and In) and Compare with the Expected Values (A,B and D) in a Loop.

Whenever the Comparison satisfies Separate the data in the format of your choice.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 5 of 11
(3,626 Views)

Instead of "different 1D arrays", I would recommend a 2D array with one row per payload.

 

Do you have the entire data available or is new data coming in continuously? What should happen to incomplete frames? Are all frames of the same lenght?

0 Kudos
Message 6 of 11
(3,616 Views)

Hi USTC,

 

what's wrong with my last suggestion?

Why do you think you need to create a new thread for the same topic?

 

separate the data in the middle of the end of the frame header

You really should rephrase this sentence!

What's "in the middle of the end of the header"? 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(3,607 Views)

@GerdW

 


@GerdW

Example:

check.png


Thank you for your reply. The tunnel mode output of the loop structure should be a connection instead of  index. If the tunnel mode is the final value or index, the output has only one set of data, and the tunnel mode is  connection. The eligible data is repeated 16 times. Collect output to an array, why?
Question 2: Why use a circular structure to output why use a 2-D array, and take a 1-D array should be fine.

0 Kudos
Message 8 of 11
(3,560 Views)

Hi USTC,

 

The tunnel mode output of the loop structure should be a connection instead of  index.

Why do you think so?

When parsing datastreams I prefer to receive an array of "messages" instead of another "stream of messages". That way I can use an autoindexing loop to process those messages. That's why I used the indexing tunnel.

In your case a "message" is a 1D array of values, so my suggestion delivers a 2D array of values.

 

Conclusion: when you prefer concatenated data you could use the concatenation mode. It's up to you!

 

Why use a circular structure to output why use a 2-D array, and take a 1-D array should be fine.

Where do you see a "circular structure"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,557 Views)

Thank you for your prompt reply. In your plan, there is a problem with the loop structure stopping. It stops when it collects a set of data.


@GerdW捕1获.PNG

 

0 Kudos
Message 10 of 11
(3,553 Views)