From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help - 2D Array Length Error and Removing Header Row

Solved!
Go to solution

I have searched the LabView Forums as well as done a general search of NI documentation, but can't find anything that directly addresses my problem(s). I am relatively new to LabView, but have been programming on a large LV project for about 7 months now, so I'm not a rank beginner. I have experience in programming in text-based languages, but I get stumped by LabView again and again over things like this, which is very frustrating.

 

My current issue -- I am reading an external file in spreadsheet format with Read From SpreadSheet File. The first row in the resulting 2D array is the headers for the columns. I need this header row in other contexts (reports, tables), but I don't need the header row for a particular context. I just need the values from the file.

 

I have tried removing the header row, but Delete from Array at index 0 doesn't seem to work as I expected and the examples of working with 2D arrays on the Forums doesn't address my issue. Or at least I don't see an easy solution based on the threads I read.  I tried getting the length of the array before removal, to compare with after, but ran into a new and different issue. I wired up an Array Size to try to get the length of the 2D array, but got an error, even though I followed (I thought) the examples I found in the documentation and even though the Error List says my source and sink have identical datatypes.

 

My company's policies prevent me from uploading any actual code, but I've provided a PNG snippet of the code where the problem occurs. 

 

Can anyone provide a solution?

 

0 Kudos
Message 1 of 6
(3,176 Views)

Quick suggestion. Delete the offending wire. Right click the output of the array size and select 'create indicator'.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 2 of 6
(3,162 Views)
Solution
Accepted by topic author lharley

In preparing the PNG image for the post, I noticed that I had a 0 for input into the Delete From Array. The length of 1 did the trick and removed the first row, as hoped for. Sorry for the post on that topic. 

0 Kudos
Message 3 of 6
(3,159 Views)

I did as you suggested, created the numeric indicator by right-clicking the Array Size icon, but I still get an error on the wire from the Array Size to the Indicator, as before. 

 

As a person trying to understand LabView, why would right-clicking to create the numeric  indicator be different from creating a numeric indicator from the Controls palette, if they are the same data types? Why would you suggest this answer as a possible solution?

0 Kudos
Message 4 of 6
(3,157 Views)

Because according to the error message you posted the source is a 1D array(32 bit integer). The sink is just a 32 bit integer.

I'm not sure why the method did not work for you. I use this method all of the time and never had that problem. Much faster than going to the front panel and creating a array container>>then create a numeric indicator>>then change the representation of the numeric indicator to I32>>then drag the numeric indicator into the array container.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 5 of 6
(3,151 Views)

Array size returns an array if there is more than one dimension. 

 

Also you don't need to delete from array and index array in order to get the headers separate from the data.  See below.

 

test_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.
0 Kudos
Message 6 of 6
(3,119 Views)