LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write 1D array boolean to excel file in columns

Hi All,

 

I am trying to take a 1D array of boolean value read from the DAQ and write to excel (or .cvs) file so that the numbers can be appended in columns. 

 

The DAQ has 96 inputs so in my block diagram I have a 1D array output of 96 elements.  if I write the 1D array output using Write To Measurement File VI, it will write all the outputs in one column... but I want all the output to be displayed in one row, and append the values in subsequent row. 

 

For example, it is currently displayed as:

 

 

Excel_output.JPG

 

But I need it to be displayed as 

 

Excel_output_Column.JPG

 

My block diagram looks like this

Boolean_Write_to_File.JPGBoolean_Write_to_File-Setting.JPG

 

How can I do it?

 

Cheers,

Leon

 

 

 

 

0 Kudos
Message 1 of 5
(4,001 Views)
To get that result you need pass your 1D array through an array builder with only one input. Logically, this creates a 2D array with only one row so it should store as you want.

Mike.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(3,968 Views)

Thanks for the input. Though I used a different method but the 2D apporach is pretty much the same and got me the result I wanted:

 

Boolean_Write_to_File-Transposed.JPG

I used Build array VI -> Convert to dynamic data type -> Convert from dynamic data type -> transpose matrix -> convert to dynamic data type2.  

 

This may not be a big issue, but the Time Column appeared in excel sheet seems to be only correct at the first row. The subsequet row always shows 01/01/1904 00:00:00.. How can I fix this? 

 

Boolean_Write_to_File - Time column.JPG

 

Leon

 

0 Kudos
Message 3 of 5
(3,941 Views)
Don't use the express Vi to save the file. It's inefficient anyway.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(3,935 Views)

You are using Write to Measurement File, which "hides" from you a lot of details (but requires no thinking on your part).  In this case, it is writing a TimeStamp in Cell A2 and either writing 0 or probably not writing anything in the remaining cells in Column A.  A TimeStamp whose value is 0 is 1/1/1904, 00:00:00.

 

Bob Schor

0 Kudos
Message 5 of 5
(3,930 Views)