取消
显示结果 
搜索替代 
您的意思是: 

More array manipulation

已解决!
转到解答

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 项奖励
1 条消息(共 10 条)
5,294 次查看

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 case尴尬表情]


"Should be" isn't "Is" -Jay
0 项奖励
2 条消息(共 10 条)
5,266 次查看

Oh Darn,  Rushed again- this is better高兴表情

Capture.PNG

破坏者
Stop Laughing Tim!

"Should be" isn't "Is" -Jay
0 项奖励
3 条消息(共 10 条)
5,243 次查看

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.



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 项奖励
4 条消息(共 10 条)
5,212 次查看

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 项奖励
5 条消息(共 10 条)
5,162 次查看

Any ideas?

 

 

0 项奖励
6 条消息(共 10 条)
5,126 次查看

Got it to work.

Thanks to all who helped.

0 项奖励
7 条消息(共 10 条)
5,107 次查看

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 项奖励
8 条消息(共 10 条)
5,049 次查看
解答
接受人 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).



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
9 条消息(共 10 条)
5,034 次查看

Makes sense. Thank you Crossrulz.

0 项奖励
10 条消息(共 10 条)
4,956 次查看