LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering a 2d array(x and y) based on data in y column

Solved!
Go to solution

Hii Friends,

 

Can anyone help me with the following problem.

 

I have a two columns ( say p and s) as in the excel file consisting of 408 rows.

I need to delete those values in the s column which are above 0.005. When i delete this value, the corresponding p value should also be deleted.

 

I have made a part of the labview code that accepts the .csv file and tried using the 'Inrange function for filtering action.

However, the output file always returns me the original input file.

Can anyone lemme know what i am doing wrong here.

I am using LV2013. Attaching both excel and VI files.

 

Thanking you.

Download All
0 Kudos
Message 1 of 7
(5,053 Views)

Hello Pa1_korea!

 

As I can see in your VI, You are only comparing (in range) the first value on your Array (zero row). There is no way (on your code) that you can compare the values of the rest of the rows.

How can you solve that? Putting that section on a while or for cicle in order to index all the rows. 

Moreover, You need to set the value of the upper limit as 0.005 and the lower as the minimum value you want.

Finally, Try to correct the best data value on the indicators and controls. For example, For the index of the array, is better to put an Integer than a double.

 

Regards.

0 Kudos
Message 2 of 7
(5,011 Views)

Can you paste a snippet or upload a LV 2012 version?

0 Kudos
Message 3 of 7
(5,009 Views)
Solution
Accepted by topic author Pa1_korea

Pa1_korea wrote:

Hii Friends,

 

Can anyone help me with the following problem.

 

I have a two columns ( say p and s) as in the excel file consisting of 408 rows.

I need to delete those values in the s column which are above 0.005. When i delete this value, the corresponding p value should also be deleted.

 

I have made a part of the labview code that accepts the .csv file and tried using the 'Inrange function for filtering action.

However, the output file always returns me the original input file.

Can anyone lemme know what i am doing wrong here.

I am using LV2013. Attaching both excel and VI files.

 

Thanking you.


 

It's a lot easier using a conditional tunnel than doing it your way using an "In Range" function.

 

Filtering CSV Data.png

Message 4 of 7
(5,006 Views)
Solution
Accepted by topic author Pa1_korea

You could also do it like this where you only do the comparison one time and then build the conditional array afterwards.  Computationally, it is probably the same as what jamiva posted but this seems a bit cleaner to me.  Opinions....noses.

Example_VI_BD.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 5 of 7
(4,987 Views)

Thanks a trillion aputman....The code worked..

0 Kudos
Message 6 of 7
(4,965 Views)

Thanks a lot Jamiva..the code worked.....

0 Kudos
Message 7 of 7
(4,963 Views)