LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cut elements from 1d array

Hello everyone!

 

I'm trying to implement a simple trick, thought couldn't find an appropriate simple solution. I have an initial array of bits. Then I periodically add fragments of 10x1 in it. The problem is to clear the array afterwards and get the source array. I'm trying to implement it in MathScriptNode. 

Basically I need to delete all arrays B=[0 0 0 0 0 0 0 0 0 0] from array A.

In MathLab it is done with 

C = A(setxor(cell2mat(arrayfun(@(x)(x:x+length(B)-1),strfind(A,B), 'UniformOutput', false)), 1:length(A)));

 q1.jpg

How to do it in MathNode in LabVIEW?

0 Kudos
Message 1 of 8
(4,007 Views)

Hi beatle,

 

why do you want to use the "MathNode" (whatever this is)?

Why not use plain G?

And what do you want to show with this small image?

 

Keep your boolean array in a shift register. Search for 10 consecutive FALSE bits and delete them from the array, when found. Iterate until no FALSE blocks are found…

Best regards,
GerdW


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

Hi!

Sorry for innacuracy, I corrected my post.I know how it should be in theory, I can't design a concrete implementation for it - a code in MathScript 

0 Kudos
Message 3 of 8
(3,990 Views)

If I undestand your question, I think all you want to do is maintain a copy of the origional data, and then switch that copy back in when you want to reset to the originoal data.  You could do this a number or ways, some are better than others depending on your implementation.  I am under the impression that you have an array of data you want to feed into a mathscript and have some result come out.   In this case, all you need to do in this case is store the original data in a shift register,local variable, or a plain old wire and then replace the results with the origional when you want to reset. 

0 Kudos
Message 4 of 8
(3,938 Views)

Actually I'm trying to add redundant bits to the digital signal and then "decode" the resulting signal - get rid of these redundant bits. Block solutions seem complicated for this task, MathScript processing does it periodically - not in real time. I hoped there are some other options, which I as a rookie don't know yet.

0 Kudos
Message 5 of 8
(3,910 Views)

Hi beatle,

 

Block solutions seem complicated for this task

"Block" (aka LabVIEW G functions) are rather easy to use - once you start to THINK DATAFLOW… 😄

Best regards,
GerdW


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

ok, I'm not asking for a ready solution - this forum doesn' work this way. If you need to implement a high-speed signal processing with coding-decoding of a signal you will use G functions? What functions then, from what pallete? Array functions? Ok, add fragment to array is easy, delete it - easy. But finding a sequence in the array in a random place, that matches your condition - pain in the ... 

I mean this flow:  adding a fragment to the source signal and send it - receive and find a fragment - delete the fragment and possibly further change the signal.

0 Kudos
Message 7 of 8
(3,894 Views)

Hi beatle,

 

 

implement a high-speed signal processing

What is "high speed" to you?

 

you will use G functions?

Yes.

 

What functions then, from what pallete? Array functions? Ok, add fragment to array is easy, delete it - easy.

You noticed my comment in this message?

 

But finding a sequence in the array in a random place, that matches your condition - pain in the ... 

Why is it PITA to search for a boolean TRUE, then search for the next boolean FALSE and check the distance between both indices?

When the distance is greater than 9 you know you found a block of 10 TRUE bits…

Best regards,
GerdW


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