LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing array relative to a table control

Solved!
Go to solution

 

Hi, I have an input table “composition” consisting of hydrocarbon components. I’m also using an array as a look up table, table B.1 in this case. There are 21 gas components, and 21 molar masses that correspond to each of the components. However, and here is my dilemma, as you can see Im indexing all values of molar mass. However, I only want to index the molar mass values that have a corresponding non zero value from my composition table, or probably more realistically, replace the molar masses that have a mole fraction of 0, to a 0 value for molar mass.

E.g.

Methane > 0.9 >16.043

Nitrogen > 0.01 > 28.0135

Carbon dioxide > 0.01 >44.01

Ethane > 0 > 0 (replaced expected 30.07 with 0)

Any ideas?

 

Thanks

0 Kudos
Message 1 of 4
(3,069 Views)
Solution
Accepted by topic author labnoob

Hi labnoob,

 

you should actually use your "components" table for getting the desired results - right now it's wire ends at the loop input!

 

- You don't need a for loop to get 21 consecutive elements of an array - you only need one ArraySubset function.

- "ConvertStringToNum" works with arrays too.

- Analyze your components "Mole Fract" column by comparing with ">0", convert the resulting boolean array to 0/1 and multply with your mole mass array - you're done with some simple (polymorphic array) math...

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,053 Views)

I like the sound of that. Ok, i will take some time to digest your advice and try and implement this. 

 

Thanks mate

0 Kudos
Message 3 of 4
(3,050 Views)

Ok, done it 🙂 works a treat and i can see this is a much better solution than the direction i was heading...

 

Thanks again

0 Kudos
Message 4 of 4
(3,047 Views)