Overview
When logging data in your applications sometimes the default behaviour of appending files does not do exactly what you would expect. By default when writing to a spreadsheet in LabVIEW you can append to the bottom row of the file and end up having a file that's tall in height but small in width. However, it's possible that in some cases this will not be satisfactory and you will want to log your application in chunks of samples stacked together column next to column. This example does exactly that with 2D Array manipulations.
Description
The program generates two random numbers (which in your application could for instance be time and a corresponding reading). These two values are then "bundled" into a column of data for one sample. Then this is repeated continuously and new samples are stacked horizontally (rather than vertically). After that we check whether file path control is empty and if so, it creates a file. But if the file already exists the program then appends to the it in horizontal axis. Please be aware that if column number is different that his will not work and cause faulty behaviour, but feel free to implement additional functionality to check for that and act accordingly if you're interested in improving this example.
Steps to Implement or Execute Code
Requirements
LabVIEW 2012 or later
Additional Images or Video
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.