LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete unwanted rows in 2D array when not knowing the index of which to delete

Solved!
Go to solution

Hi!

I am kind of new to Labview and I hope that someone can help me with my problem.

 

First I import a spreadsheet from Excel into a 2-D array of string. For each row in the array I then want to compare the data in a specific column (which is a date (time stamp)) with today's date. Rows containing a date with lower number than today's date I want to put into a new array and the rest I have no need for.

 

I have succeeded in creating a time stamp for today's date so that it is consistent with the Excel time stamp. But for the comparing and creating a new array part I have no idea about how to do it. I have tried numerous ways with no luck at all (probably because I don't understand all of the VIs that I need to use).

 

Happy for all help that I can get!

0 Kudos
Message 1 of 5
(2,875 Views)

Send the 2D array to a loop, which'll then loop through each and every row as a 1D array.

Grab column X with index array and convert to timestamp, compare with a timestamp of today, and if less than today, build array, else keep former array.

 

When all rows have been checked your built array should be the one you're looking for.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(2,870 Views)

Thank you for the answer!

I (think) I understand the concept that you are telling me but there is one thing that I can't understand (I have attached a picture of what I believe you told me to do). I did not understand what to do when the comparison is false. What block should I use? Now the table after the loop is the same as it was before so nothing really happened.

 

Is the solution on the picture what you mean?

0 Kudos
Message 3 of 5
(2,860 Views)
Solution
Accepted by topic author Tokmas

You're on the right track! (although your attempt will only list the datetime values)

What you'll need to add/change is the resulting array need to be connected to the loop as Shift register (with an initial empty array), and in the Case you'll either use Build array to add the current line or send the unmodified through.

You'll probably want to send the full array through and not only the datetime.

 

You'll probably need some tweak to only use date, but similar to this:

LVBuild array if date.png

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 5
(2,841 Views)

Thank you very much! Works perfectly 😃

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