LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read and write from and to text file

 Hi All,

 

I am trying to read some portion of a text file and make measurement and calculation with those numbers and write back to the same text file and also to a excel file. I need to create a 2 D  array of 20 by 20 from the text file values and write to front panel table and to text file. but I am having problem with it, obviously I am new to this. Please help me.  thanks much

~ Johnny
0 Kudos
Message 1 of 5
(2,875 Views)

 

Sorry I forgot to attach my VI.

 

How do you edit posts?

~ Johnny
0 Kudos
Message 2 of 5
(2,873 Views)

here's the text file that I am reading it from

sorry for repeated posts

 

~ Johnny
0 Kudos
Message 3 of 5
(2,871 Views)

Johnny,

 

1. To edit a post click on the Options link at the right side of the page.  You only have a limited amount of time in which to edit. If that time has elapsed, the edit option will not be available.

2. Why are you reading from the file twice with two different File Read functions? Why are you not using the data from the first Read? That first Read ends somewhere in the middle of IMPEDANCE_IMAGINARY.

 

 

I suggest that it might be better to read the entire file. Then parse the file to get the sections you want.  Match Pattern on the headers (such as IMPEDANCE_REAL) will allow you to find those sections, regardless of how many data points might be in the file. 

 

Writing back to the same file can create problems. Do you want to append data, insert data somewhere in the middle of the file, or overwrite the file?

 

Lynn

0 Kudos
Message 4 of 5
(2,843 Views)

Hi Lynn,

 

the requirement is to move C1 and C2 to each position that is given in the text file in steps and percentage value.

for example C1 has to go to first step (5%) and C2 has to go thru all steps, 5% to 95% , in 5 percent increment. 

each 100 steps translates to 1 percent increment in the capacitor value.

at the end, I need to enter the measured data (values of C1 for each step, vesus all values of C2 for all steps) and enter them at the bottom of the text file's table where it starts at : "IMPEDANCE_REAL in Ohmone line per C1 position, containing all values for the different C2 positions" and do the same for where it says "IMPEDANCE_IMAGINARY in Ohmone line per C1 position, containing all values for the different C2 positions"

 

the reason I read the file twice, is that if it read it once, I couldn't connect it to spreadsheet string to array vi.

as you can see, I also like to use the write to measurement file and build table express vi's to display the table on the front panel and save the data to ni data file format so later I convert it to excel  too.

any thoughts?

thanks for your help

~ Johnny
0 Kudos
Message 5 of 5
(2,819 Views)