LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer data from data file into 2D array only once?

Solved!
Go to solution

Attached file will write same data file into 2D array 4 times. Output needs to be in a 2D Array.

Will someone provide a solution or reason as to why data is been ouputted 3 additional times? Thanks,

0 Kudos
Message 1 of 9
(3,214 Views)

What you are doing does not make any sense. You have comments about retrieving from different columns but the code does not do that at all. Each once of your String to Spreadsheet operates on the entire file.

 

Why did you decide to write your own program for reading a tab delimited file? Why don't you just use the Read From Spreadsheet File function.

0 Kudos
Message 2 of 9
(3,210 Views)

Thanks for your reply.

 

VI in question reads data from a text data file  and writes it into a 2D array. The problem is that it writes the data 4 times into the Array. Let's say  if I make a 2 row-4 column data file , row one being,[ 1 3 5 7 ] and  row 2 being [2 4 6 7] when I run the program and select the file to be read, I will get on my array  [1 3 5 7 ][2 4 6 7][1 3 5 7 ][2 4 6 7][1 3 5 7 ][2 4 6 7][1 3 5 7 ][2 4 6 7]

 

That's the best way I know of reading data from a file and writing it into a 2D Array. Will you have a better-more effective sample of accomplishing the task without getting data written 4X into 2D Array?

0 Kudos
Message 3 of 9
(3,191 Views)
Solution
Accepted by topic author Shining_Eagle
I already told you a better and more effective method. The Read From Spreadsheet function is on the exact same palette as your Read From Text file and does everything for you. If you insist for stome strange reason to reinvent the wheel and write your own code, do it the correct way. The use of 4 separate Spreadsheet String to Array is the cause of your problem and I already told you that too. Don't you think the fact that you were getting 4 times the data is at all correlated to the fact that you are using 4 time the necessary functions? It's just plain wrong. Look at the block diagram of Write to Spreadsheet File.
Message 4 of 9
(3,184 Views)
 

Thanks a lot!

 

Yesterday just after I replied to you I removed 3 instances of Spreadsheet String to Array function and it outputted data into array only 1X. Thanks for your insights Dennis and bear with me while I become proficient in LabVIEW.

 

I used the Read from Spreadsheet File per your recommendation and it is as you say more effective. Is there any way to increase the number of digits, after the decimal point, from 3 to 5 or 6?. 

0 Kudos
Message 5 of 9
(3,146 Views)
 

Thanks a lot!

 

Yesterday just after I replied to you I removed 3 instances of Spreadsheet String to Array function and it outputted data into array only 1X. Thanks for your insights Dennis and bear with me while I become proficient in LabVIEW.

 

I used the Read from Spreadsheet File per your recommendation and it is as you say more effective. Is there any way to increase the number of digits, after the decimal point, from 3 to 5 or 6?. 

0 Kudos
Message 6 of 9
(3,146 Views)

What you have is just the resolution in the display. Internally, all digits are represented. To change the display, right click onone of the numerics in your array and select Display Format.

 

This is basic stuff. Have you seen the tutorials?

Message 7 of 9
(3,133 Views)

Thank you so much Dennis!

 

No yet, I am just on page 87 on the 6 hour tutorial. Appreciate you.

0 Kudos
Message 8 of 9
(3,115 Views)

Thank you so much Dennis!

 

No yet, I am just on page 87 on the 6 hour tutorial. Appreciate you.

0 Kudos
Message 9 of 9
(3,115 Views)