LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem writing a string to a file

hello everyone,

                      I have this code in which i am writing 3 strings and one w/f into one excel sheet. the deal is I should have four columns

into an excel sheet with the first 3 columns specifying 3 strings and the last column should contain the analog wfm values.

 

I have this VI made, but somehow cannot get the data into the excel sheet in the format I want... Can anyone please

help me out??

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 1 of 6
(2,608 Views)

try this...

 

write the string names outside the loop. convert the dynamic data to an array. use tab/end of line constants to setup text file. open text file in excel using tab seperated columns.

0 Kudos
Message 2 of 6
(2,591 Views)

It would actually be easier, and less code, to just use Write to Spreadsheet File.

0 Kudos
Message 3 of 6
(2,579 Views)

guys, thanks a lot, but, why do i have to enter the file name before I start the program? I don't want just a header in the first 3 columns (Name, ID, Place) it should be

just the same like the updating of the wfm column... something like this...

 

 

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 4 of 6
(2,561 Views)

 


@CrackJack wrote:

guys, thanks a lot, but, why do i have to enter the file name before I start the program? I don't want just a header in the first 3 columns (Name, ID, Place) it should be

just the same like the updating of the wfm column... something like this...


Your example file does not match the data that you're collecting. Your DAQ Assistant is set up to read 10 samples. Is this supposed to be 10 rows in 1 column, or 1 row with 10 columns of values? Also, the controls on the front panel make no sense as far as column headers are concerned. When you connect this to the Format Into String function you will not get an array of values - you'll get just one value. If you want all 10 values then you need to do as suggested and use the Convert From Dynamic Data VI to get the appropriate datatype.

 

 



 

In LabVIEW 8.0 the Write to Spreadsheet File exists - it's in the File I/O palette. The VI would have been found - it would just have a broken wire for the instance that's outside the loop. The issue is that in that version the VI is not polymorphic. Only a version that accepts floating point values exists. In LabVIEW 8.2 and beyond it's polymorphic so that you get a floating point version, a string version, and an integer version. If you open the VI it gives you instructions on how to create a version that accepts strings. The change is trivial, but you must save the string version in your own directory, NOT the LabVIEW vi.lib directory.

 

Alternatively, you could just use the Write to Measurement File VI since you are dealing with that clumsy DAQ Assistant, which creates that horrible dynamic data.

 

0 Kudos
Message 5 of 6
(2,554 Views)

smercurio_fc, i was just trying to write to an excel sheet in the similar format as the .csv file i sent. It doens't really matter what I have on the Front Panel, it is just to make things

easy to remember. ( I can change the headers anytime rite?, but the concept of how to get it done is imp. i guess.

 

I would like to have 4 columns and 'n' number of rows ( depends on how much time the user runs the program); somehow not able to get this.

 

whatever you said about the 'Write to Spreadsheet File'  was entirely true, i do have a broken wire, outside the loop. I will try all the steps you told..

 

P.S. sorry for the bold, i dnt realize it untill i had posted 😛

 

Now on LabVIEW 10.0 on Win7
0 Kudos
Message 6 of 6
(2,542 Views)