LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

export an array to excel sheet

Solved!
Go to solution

Thanks, I am a little new to LabView and it wanting a 2D array always was strange if my data was only 1D. I was also using insert to array which was making a row of zeros after the data. I use "Replace Array Subset now" or will build it with correct structure.

 

Thanks,

Adepta

0 Kudos
Message 11 of 12
(480 Views)

@Adepta_Sororitas wrote:

Thanks, I am a little new to LabView and it wanting a 2D array always was strange if my data was only 1D. I was also using insert to array which was making a row of zeros after the data. I use "Replace Array Subset now" or will build it with correct structure.


I'm not sure what you are doing, but you should only use "Build Array", not "Insert to Array" or "Replace Array Subset".

 

Let me try to explain.  Suppose I have a number, say "4".  I open a Block Diagram, drop down a "Numeric Constant" from the Numeric Palette, change the "0" to a "4", and what do I have?  An I32 number, right?

 

Now I right-click this, and say "Change to Array".  LabVIEW draws an "Array Box" around it, and shows the 4 is sitting at offset 0.  If I attach a Wire to this Array, it is the slightly-thicker Blue Wire of a 1D Array.  If I connect this 1D Array to the Array Size function, it will return me an I32 that shows the value "1" when I run the code.  Note that you have to make sure that there's a value in the Array (otherwise it will be an "Empty Array" and have a size of 0).

 

Now drag down on the Array Index box on the left to make a 2D Array.  Note the "Wire" from the Array to the Array Size function shows 2 parallel blue lines (for a 2D Array), and the "scalar" thin wire from Array Size to the (scalar) indicator is broken.  Delete the Indicator and wire, right-click the output of the Array Size function, and note that it creates a 1D Array to hold the (now 2) dimensions.  Run the program again.  It shows you that your one numeric value, "4", is now the single element in a 2D Array of 1 row and 1 column.

 

In your case, you have a 1D Array of data, say of 100 elements.  If you pass it through "Build Array", you will get a 2D Array of 1 Row and 100 columns, which will be written as (... you guessed it ...) a single row of 100 columns.

 

LabVIEW cleverly figured out that you wanted to send only 1 row, so it outputs 1 row.  It doesn't need to allocate any more memory for an "empty extra row".  Trust me, I do this with Easy Table all the time.

 

Bob Schor

0 Kudos
Message 12 of 12
(449 Views)