LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File I/O

I want to build a vi such that it writes two arrays "range" and "height" to a text file. I should be able to enter the inputs in these arrays one by one and write them to a text file. And later I should be able to read the inputs from this files and load them into the arrays "range" and "height".

0 Kudos
Message 1 of 8
(2,687 Views)

Hi,

 

"Write to Spreadsheet File" and "Read from Spreadsheet File" will be your friends here. They are located in Programming>>File I/O.

 

-CC

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 2 of 8
(2,685 Views)

@Dhiraj072 wrote:

I want to build a vi such that it writes two arrays "range" and "height" to a text file. I should be able to enter the inputs in these arrays one by one and write them to a text file. And later I should be able to read the inputs from this files and load them into the arrays "range" and "height".


2d array.png

Message 3 of 8
(2,658 Views)

here's the vi

 

note: i notice i am not able to upload a vi...notified moderator

0 Kudos
Message 4 of 8
(2,623 Views)

To get the separate arrays back from your file, use the Read from spreadsheet VI and then "Index Array" to get the two separate columns.

 

-CC

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 5 of 8
(2,613 Views)

Thanx a lot.

0 Kudos
Message 6 of 8
(2,594 Views)

How can I add two controls(string or numeric) one for "range" and one for "height" such that I need to enter N no. of values one by one which then get stored into the arrays "range" and "height" which are then wrote into the the text file.

0 Kudos
Message 7 of 8
(2,589 Views)

I would use an event structure to control when you insert your values into the array. 

 

I've attached an example of this, and this'll populate your array with range and heights. You can then write the array to your text file as Apok showed you.

 

Event Array Add.PNGEvent Array Add FP.PNG

 

 

If you wanted to see the array populate as you pressed the button you could move the array indicator inside the event structure.

 

-CC

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 8 of 8
(2,575 Views)