12-21-2022 10:08 AM - edited 12-21-2022 10:20 AM
@User002 wrote:
Hi all. I have binary number in array, for example 000101001100010. I need to find array binary number that have 11 inside. Once it matching, it will cut the before number 11. Which is the output for 000101001100010 is 1100010. And the same function for the next array. Sorry for my bad explanation. I hope you guys can give me suggestion to me for continue my code.
We don't work well with pictures. Please attach your actual VI. Make sure that the controls contains typical default data (e.g. as shown in the picture).
All your values are les than 16 bits, so why is the datatype 32bit?
There is no "next array". each binary number is an element of the same 1D array.
>Once it matching, it will cut the before number 11. Which is the output for 000101001100010 is 1100010
If you cut 000101001100010 "before" the 11, you only get 1100010 if you cut "after" 11 AND also keep the 11. In your world, the LSB is the "earliest". Right? It really helps to define the problem exactly.
You cannot "cut", but you can set all higher bits to 0, (000000001100010) for example. Is that what you want? You also need to define what should happen if there is no "11" or if there are multiple.
This is a very simple problem! I am sure that once we know the exact problem, we can come up with a trivially simple solution! So: Attach your VI!
12-21-2022 10:59 AM - edited 12-21-2022 11:26 AM
Since you seem to prefer pictures over actual VIs, here's a picture of a solution of one possible interpretation of the problem.
This one is for U16. I am sure you can adapt it to other datatypes.
Here's how it would look if you set the binary format not to pad to the number of bits. That's just cosmetic! No change in code.