LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add an element to a two-dimensional array?

Solved!
Go to solution

 

girish_jadhav_1-1597071467519.png

I want to add date and time to the first column of the array and want it to keep updating at the same rate as the values that are being read from the Modbus. But I am not getting how to add to an already existing 2D array.

(column names are yet to be renamed)

girish_jadhav_0-1597071378283.png

 

0 Kudos
Message 1 of 5
(1,430 Views)
Solution
Accepted by topic author girish_jadhav

I probably would forget about using dynamic data and express VIs, but you can enable a time column in your express VI. You can add a timestamp to your fake dynamic data using this tool.

 

(Does it have to be excel? Why not just open a plain text file before the loop and append a new delimited row with each iteration?)

0 Kudos
Message 2 of 5
(1,402 Views)

@altenbach wrote:

I probably would forget about using dynamic data and express VIs, but you can enable a time column in your express VI. You can add a timestamp to your fake dynamic data using this tool.

 

(Does it have to be excel? Why not just open a plain text file before the loop and append a new delimited row with each iteration?)


Why do you call it fake dynamic data? Sorry, I got this VI from another student and have no idea why he did it like that. 

 

It doesn't have to be excel. I will try it with plain text file as well. 

0 Kudos
Message 3 of 5
(1,370 Views)

@girish_jadhav wrote:
Why do you call it fake dynamic data? Sorry, I got this VI from another student and have no idea why he did it like that.  

Dynamic data typically can contain a rich variety of fancy data (constructed from DBL or boolean arrays, channels, waveforms and trimming such as timing information (xo, dx, etc). Dynamic data is useful for quick and dirty proof of concept requiring 30 seconds of programming, but most advanced programmers stay far away from dynamic data end express VIs. 😉

 

You are converting a simple 1D integer array to dynamic data, stuffing it into a opaque shell with most attributes (e.g. x0 and dx) left at the default. Maybe "fake" is not the right word, but it is certainly not a really good fit for your datatype.

 

 

0 Kudos
Message 4 of 5
(1,345 Views)

@girish_jadhav wrote:
It doesn't have to be excel. I will try it with plain text file as well. 

Here's how you could write a simple tab delimited text file that you can open in excel. (Just a draft. Add error handling, etc.)

 

Write the column headers before the loop, then append rows until done (using "format into file" and array to spreadsheet string).

 

 

altenbach_0-1597100439251.png

 

0 Kudos
Message 5 of 5
(1,340 Views)