LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

To compare string array

Hi,

I am trying to develope a code using string array as the input.I need like it should compare 1st row and 2nd row in an  string array ,if it is true then it should move on to 3rd row and then 3rd row should compare with 4th row.If it is false,then 2nd row should deleted and then it should move on to 3rd row and then 3rd row  should compare with 4th row.It continues till the string array is get completed. In my code ,how to improve it? 

ex:

1100

1100

0100

0110

1011

1011

output:

1100

1100

0100

1011

1011

 
 
 
 
 
 
 
 
 
 
 
 

Capture.PNG

 

 

0 Kudos
Message 1 of 6
(196 Views)

Hi puppy,

 


puppy@11111 wrote:

In my code ,how to improve it? 

Capture.PNG


There's no code, there's just a small downscaled blurry image…

When you want to compare more than just 2 rows from your 2D array then you should use a loop somewhere in your code!

 

As you didn't provide (real) code I also provide a solution just as an image:

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 2 of 6
(192 Views)

Hi Gerdw,

 Thanks for your reply.I have shared my code here.I n my code in 1st iteration 0th index and 1st index is get compared and in 2nd iteration  1stindex and 2nd index is get compared but  what I need is like 2nd and 3rd is should get compared so what changes I have to do in my code.MicrosoftTeams-image (24).png

 

0 Kudos
Message 3 of 6
(143 Views)

Hi puppy,

 


puppy@11111 wrote:

I have shared my code here.


No, there is no code.

Again just an image of code: we cannot debug/edit/run images with LabVIEW!

 


puppy@11111 wrote:

I n my code in 1st iteration 0th index and 1st index is get compared and in 2nd iteration  1stindex and 2nd index is get compared but  what I need is like 2nd and 3rd is should get compared so what changes I have to do in my code.


Well, a simple change would be to recreate MY code instead of YOURS…

(Your code does not what is required to do: so it is wrong!)

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
Message 4 of 6
(128 Views)

puppy@11111 wrote:

Hi,

I am trying to develope a code using string array as the input.I need like it should compare 1st row and 2nd row in an  string array ,if it is true then it should move on to 3rd row and then 3rd row should compare with 4th row.If it is false,then 2nd row should deleted and then it should move on to 3rd row and then 3rd row  should compare with 4th row.It continues till the string array is get completed. In my code ,how to improve it? 

ex:

1100

1100

0100

0110

1011

1011

output:

1100

1100

0100

1011

1011

 
 
 
 
 
 
 
 
 
 
 

As has been asked already, please attach your VI, preferably with typical default data in all controls.

 

First we need correct instructions:

 

  • Your description does not agree with your example.
  • You need to define the comparison (equal, not equal, etc.) else we don't know what "true" means.
  • Assuming that we do equal comparisons, but you apparently don't seem to delete the second row (1100) if the third and fourth row differ, which is the case here. Do you instead mean the second row in the comparison, i.e. actually the fourth row here? It is very important to avoid ambiguities!
  • Apparently you always want to compare the even rows to the adjacent odd row.
  • What is the string array? (2D array of strings, one character each? 2D array of strings with one column and 4 characters per element?
  • If these are typical values, you could convert each row two a 4bit integer and operate on 1D numeric arrays. Much more efficient.
  • How big are these arrays?

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 6
(106 Views)

@altenbach wrote:

If these are typical values, you could convert each row two a 4bit integer and operate on 1D numeric arrays. Much more efficient.

Here's how that could look like (assuming all strings are single character and either 0 or 1):

 

altenbach_0-1624548517358.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 6 of 6
(102 Views)