LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

More array manipulation

Solved!
Go to solution

Hi,

In the attached VI I search for a byte labeled "CC" and build a subarray of length 5 starting at byte CC. I do this search in the 1D array which updates from an external source. The 1D array may contain incomplete data, where the first three bytes I need to build my subarray may appear up at the end of the 1D array and the next two bytes may appear up at the beginning  of the next 1D array. But always successively...

If the five bytes are not present in the 1D array, I want to keep whatever I have in "memory" and complete the rest of the array using the next 1D array that updates. 

Ultimately, each subarray of 5 bytes will go through another logic to convert them into engineering units and display on the control panel. Since Also, there may be multiple bytes labeled CC in the 1D array, I need to be able to capture each value and not just the last reading. 

 

Thank you for your help.

0 Kudos
Message 1 of 10
(3,793 Views)

If I read that post correctly (I might not have done that) This should help.  Even If I Did read that wrong you might get some ideas.

Capture.PNG

 

Note: I am showing several memory elements like Shift Registers and Feedback Nodes.  And a few output tunnel option; Use Default if unwired, Last Value, Concatinating and conditional.  The LabVIEW Help file will give you a lot of knowledge about those right-click options and memory elements.  Queues are also (not shown) necessary to keep the processing loop updated with new data!  Lots of good info to digest!  Have some fun.

 

EDIT[ Match substring needed to be the first element in the strcat in the second caseSmiley Embarassed]


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 10
(3,765 Views)

Oh Darn,  Rushed again- this is betterSmiley Happy

Capture.PNG

Spoiler
Stop Laughing Tim!

"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 10
(3,742 Views)

Jeff, what is up with that last case structure.  Don't you realize it will always be TRUE?

 

Anyways, here is an alternative to Jeff's inner loop using the array instread of changing it to a string.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(3,711 Views)

Hi,

I made progress with the examples you showed me and thank you for your help. Now I am struggling with one thing: I want to display all values (and it is doing that), but I want the last value to remain and not continue loop through all possible values. If I update Array 3, I still want the last update to remain on Array.

Any idea how I can do that?

 

Thanks!

0 Kudos
Message 5 of 10
(3,661 Views)

Any ideas?

 

 

0 Kudos
Message 6 of 10
(3,625 Views)

Got it to work.

Thanks to all who helped.

0 Kudos
Message 7 of 10
(3,606 Views)

Hi Jeff and Crossrulz,

I am struggling to understand the logic you have going to the conditional terminal (the NOR gate), can you elaborate on the purpose of that?

 

Thanks!

0 Kudos
Message 8 of 10
(3,548 Views)
Solution
Accepted by topic author TeamHalli

We only want to include a value if the CC was actually found and there were still 5 bytes to get.

 

1. If CC was not found, the Search 1D Array returns -1.  After the adding of 1, we will have a 0.  If it equals 0, do not include.

2. If CC was found, but there were not enough bytes left, then the size of the subarray would be less than 5.  But we don't want to include that since we need the full message.

 

So if either of those two conditions happened, we do not want to include them.  So the NOR (Not OR) will become a TRUE only when both of those conditions are FALSE.  The loop also stops when either of those conditions are met (conditional is set to Continue While TRUE).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(3,533 Views)

Makes sense. Thank you Crossrulz.

0 Kudos
Message 10 of 10
(3,455 Views)