LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid a row from csv

Hi 

I am trying to avoid a row can anyone give some solution (vi Or which blocks to be used) for this. 

I need to avoid a entire row because there are some special characters no need of that row, I need to avoid that row and continue to read other rows and columns and save all data except special character rows it in another csv. 

0 Kudos
Message 1 of 6
(1,232 Views)

Correct me if i am wrong...

So you are reading a csv, then you want to remove all those special character row and then save it to another file???


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 6
(1,209 Views)

Right off the top of my head I would probably...

 

  1. Read a row as a String
  2. Check the string for special characters
    1. IF string contains special characters
      1. Go to 1
    2. Convert string to numbers (if that's what you are doing) and "save" the string
  3. Go to 1 until done
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(1,195 Views)

Do you know the index of the row?

 

Just read the entire file as a 2D array, delete the row, write the smaller 2D array to a new file.

Message 4 of 6
(1,191 Views)

@altenbach wrote:

Do you know the index of the row?

 

Just read the entire file as a 2D array, delete the row, write the smaller 2D array to a new file.


Read the entire file into an array

Search the array row by row for special characters

Delete the row containing special characters

Save the array to a file

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 6
(1,175 Views)

Do you know that there is only one row with special characters or could there be multiple? What is your definition of a "special character"? You have not even explained if the fields are numeric or strings.

 

  1. Read the file as 1D string array of rows
  2. Auto-index on a FOR loop
  3. Check for "special characters"
  4. Use conditional indexing to only keep the rows without special characters
  5. Write back to the file.

 

There are many ways to optimize all this, of course. Can you attach a simple example file?

0 Kudos
Message 6 of 6
(1,171 Views)