05-24-2023 03:14 PM
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
05-26-2023 08:49 PM
@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
03-10-2025 10:23 AM
Hey Bob,
I am trying to do something similar to what is done in this thread. I want to make a single experimental log spreadsheet that appends a new row every time I run my VI, as of now I am doing so by using a CSV and using the Write to File function. But as you can imagine, a CSV is not a great tool to store data. I want to use an xlsx format. I am not able to follow your procedure for this reply. I am using Labview 2024 and Labview 2020. Thank you
03-10-2025 11:06 AM
@Guillermob13 wrote:
Hey Bob,
I am trying to do something similar to what is done in this thread. I want to make a single experimental log spreadsheet that appends a new row every time I run my VI, as of now I am doing so by using a CSV and using the Write to File function. But as you can imagine, a CSV is not a great tool to store data. I want to use an xlsx format. I am not able to follow your procedure for this reply. I am using Labview 2024 and Labview 2020. Thank you
IMHO: A .csv file is is about a close to universal file format as one can get to store data. As the data is human readable with any text editor. CSV files compress well for storage and can be easily imported into Excel for analysis. In our lab all of our raw data is stored in .csv files and in my >35 years in the industry I have never found a need or any benefit that was worth changing to another format.
Not to mention the extra money involved in putting Excel on every target machine to save the three mouse clicks in takes to import a csv into Excel is not worth it. Also since Microsoft had moved to %100 SAS for MS-Office apps it add a whole level of complexity and headaches. As the end user must be logged into the corporate network to gain access to their Excel licence. None of our test systems are connected to the corporate network or the internet. Because the security measures required for this connectivity are very strict and prohibitive.