LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading data in to array.

Hi

 

i am trying to load data into an array that has an unknown amount of rows.

 

I've got my code loading my data as i'd like it. Once its loaded as a sheet i can then print it out.

 

My problem is i don't know how to have multiple lines just adding one to the next with out using a save to file function. The insert to array doesn't seem to work properly.

 

I've included my code and my small database sample.

 

I hope someone can help.

Download All
0 Kudos
Message 1 of 4
(3,421 Views)

If you are using Insert into Array, that is the wrong function about 99% of the time.  You should be using Build Array.

 

If you wire a 1-D array into the top, and an element into the bottom, that adds a new element to the end of the 1-D array.

0 Kudos
Message 2 of 4
(3,420 Views)

This seems to be a continuation of your other questions dealing with this same file.

 

Considering that you have no Insert Into Array in the VI you posted, I don't understand what you are asking. And even if there were, I still wouldn't understand what you're asking since it makes no sense to me. What exactly are you trying to do?

 

Side-comments regarding code:

  • Using Build Path and providing an empty path to the "base path" input makes no sense. The Read from Spreadsheet File will simply receive the string "Database122.lvm", but be unable to open it.
  • Do not use an Equal function to compare the output of Search 1D Array to -1. Simply use a Less Than 0? function. Worse, you made the -1 a float! 
  • In the loop you are peeling off rows from the 2D array that is read in and then replacing a pre-initialized array. You don't really need to do this, as auto-indexing will accomplish the same thing, eliminating the Initialize Array and Replace Array Subset. 
  • Based purely on the output, I don't see why you're not just using Array Subset instead of the for-loop. See attachment, which give you the same exact answer as your code.
0 Kudos
Message 3 of 4
(3,403 Views)

Hi

 

thanks for all of your help. It may be of a similar subject but i have actually managed to get my other code working fine and this is a external program to support aspects of it. I realised what i was doing with the open file, close file was completely off track and also a lot of the defaults are what i was setting up, therefore not required.

 

Thank you for the adjusted file. You can learn alot from examples and help with Labview so the support is appreciated.

 

I will try the file in the morning when i arrive at work.

 

 

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