LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing an array stream

Hello there,

 

Couple of things,

 

I have a 2D array out of whcih i'm indexing out a column containing a set of 200 controller names. The basic types are as listed in the attached "Parsing sample.vi". The example also shows the required parsed format for each controller type programatically. A sample code for programming my application is highly appreciated.

 

Secondly,  I have two 2D arrays in which I'm comparing first 4 column elements of each row of both the arrays.( 1st 4 elements of 1st array with 1st  4 elements of all rows in 2nd array). For every match of these first 4 elements from both array, I would like to build a composite array. Composite array shalll be a summation of : Row from the 1st array ( where the 1st 4 elements match) + Rest of the elements from second array(other than the match, where the 1st 4 elements match).

The vi that I now have works fine for just one match. But I would like to be build composite rows for multiple matches. If you could kindly correct the code to satisfy this requirement that will be great..!

 

Thank you

 

Shaun

Download All
0 Kudos
Message 1 of 5
(2,902 Views)

I took a look at your code and 1)  I am not sure what you are asking and 2) it looks like it does exactly what you want it to do.

1. Parsing Code: Can you attach an example of some of the work you have already done so we can help you to get it working?

2. In the 2nd you state " Phi, fuel, dial , speed  is repeated twice".  I looked in the tables and unless I don't understand I would say no it is there only 1 time.  so the VI does exactly what it should.  I wonder if you have changed the data and not saved it as default.  So open your VIs and select Edit>>reinitialize values to default.  Then run your code and you will see that the "Phi, fuel, dial , speed" line is there once and the code works.

0 Kudos
Message 2 of 5
(2,883 Views)

Evan,

Thanks for replying. Here's somemore information that you wanted to know:

1. I'm attaching the vi that I have now that works on controller type. The input would be an 1D array of aIl controller types. I would like the code to sense the controller type programatically and parse them asper my requirement in my previous posting. (Plot, bit, HI/LI , CH)

2. For every first 4 elements of each row in 1st 2D table, compare the first 4 elements of all the rows  and build the composite rows for all the matches of 2nd table.

composite row: Row in 1st array where the 1st 4 elements match + rest of the elements of the row in 2nd array where the 1st 4 elements match.

So be as many composite rows as the number of matches( 1st 4 elements) in the second array.

Hope I'm clear now.

Thanks

Shaun

 

 

 

0 Kudos
Message 3 of 5
(2,870 Views)
Hi Shaun,

I think you are on the right track for parsing the strings into the table you need depending on the type of the controller.  I looked at your code to see if there was an easy way to distinguish the controller types programatically, but as the controller types are not defined, I do not know which types of strings should be classified as different controller types.  Therefore it is impossible for me to sort the channels by controller type and be sure I am doing what you are looking for.  I defined my own types and was able to get the VI working partially.  You could add comments to your code that would explain which controller is specifed as Type 1, Type 2, etc because:
1) that will help with future development as the code becomes more complex, and
2) it makes it possible for others to figure out what the code is even for. 

Before I made up my own controller types, I tried running each array element as each type (1, 2, 3, and 4).  The subVI you created didn't appear to work correctly for any of the elements.

As I edited the VI, it became apparent that you weren't too far off from correct behavior, it just wasn't apparent how I should use the VI.  To me, it looked like one thing that was causing a problem for you is the indexing system of LabVIEW arrays.  LabVIEW arrays index begining with 0, not 1.  Realizing this, we can get a results similar to the desired results you created in your first post.  I am attaching the parsing VI and the subVI that you created but modified to work together.  Download both of them and then run "Parsing sample.vi".  The results from that VI get close to the results you desire.  You can expand on that work to get it to all come together.

Also, as Evan stated, the example data in your attached VI "Row Match 2.vi" does not demonstrate the behavior you describe as a problem.  The default data only exhibits one match because only one match exists for the default data. 

Hope this helps!

Cheers,
Spex
National Instruments

To the pessimist, the glass is half empty; to the optimist, the glass is half full; to the engineer, the glass is twice as big as it needs to be has a 2x safety factor...
Download All
0 Kudos
Message 4 of 5
(2,833 Views)

For info, this thread is a continuation of here http://forums.ni.com/ni/board/message?board.id=170&message.id=218715

The two threads are cross-linked.

David

Message 5 of 5
(2,822 Views)