LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

logging numeric data (its back to front)

Solved!
Go to solution

Hi guys,

              im trying to log data from multiple numeric indicators on my front pannel every second, i want to log them to a seperate colum in a tab file so they can be imported to excel.

 

I have got it working but the data is upside down, that is to say my first readings are at the bottom of the spread sheet and my last readings are at the top.  How can i turn the array upside down before i write it to file.

 

Also i would like to add a header or title to identify each collum?

 

I have attached a picture of this part of the program. Cheers, Zac

 

 

0 Kudos
Message 1 of 16
(4,374 Views)
Solution
Accepted by topic author Zac_Acal

Reverse all of the inputs on your build array.  But the wire from the shift register on top and the wire from the local variable on bottom.

 

Do you need the local variables?  Where is the data coming from?  You might set yourself up for a race condition.

 

Rather than having all of those build arrays, you may want to build an array of the new data.  Then put that data onto a single 2-D array that goes through the shift register.  It will eliminate 12 of the 13 shift registers and a lot of wiring.  You might not need the transpose array after that.  You'll just have to check the way array gets built because rows may become columns and vice versa.

0 Kudos
Message 2 of 16
(4,369 Views)
Also, do not initialize the shift register(s) with an integer datatype if you're dealing with doubles. This creates unnecessary data coercion (that's what all the red dots are on your shift registers) . Right-click on the array element and select the correct datatype.
0 Kudos
Message 3 of 16
(4,356 Views)

Thanks for the info guys, reversing the inputs works fine,  how about adding some headder info / colum lables to the file ?

 

I tryed to right click the array elements but it says this item doesnt have any properties.

 

 

Zac

0 Kudos
Message 4 of 16
(4,337 Views)

Oh, just to clarify, the data is comming from a PLC via an OPC server, onto front pannel indicators, then i'm logging to file every second.

 

Zac

0 Kudos
Message 5 of 16
(4,336 Views)

Move your file path control outside the loop.

 

Use the the basic file functions on the file I/O palette to write out the header string.  Feed the file path wire into the for loop and into the Write Spreadsheet File function with it set to append new data.

0 Kudos
Message 6 of 16
(4,316 Views)

When i take the path outside the for loop and enable "append to file" on the write to spread sheet function it repeats the data in the file, so i get the same data saved a number of times.

 

still cant figure the header out, if i use write to text file to put a headder in the path/refnum out put can't be connected to the path input on my write to spreadshet file??

 

Thanks, Zac

0 Kudos
Message 7 of 16
(4,309 Views)

What is the action of the Log Data button?  Is it latched so that it only executes once per press, or is it switched so that it maintains its true state until you press it again?  How often do you press the button?

 

What is happening in the false case of that case structure, nothing?

 

It looks like you are writing out your whole dataset each and every time the button is true and overwriting the file.  If that button is true a lot, that seems like an inefficient way of storing your data, and there are more efficient ways of writing to a file.

 

However, what you can do is put the file I/O functions in that case structure and set the Write spreadsheet function to append data.  Then when the button is true, the file is opened, the header is written to the beginning of the file, the data array is appended to that, then the file is closed.

0 Kudos
Message 8 of 16
(4,304 Views)

The action of the log data button is switch.  I want logging to take place every second whilst this button is pressed and stop when it is pressed a second time.

 

In the "false" case nothing happens. (yet, meby some error checking later)

 

As far as i understand it, i am (reading the current value of thoes variables into an array and saving them to a file once per second) whilst the log data button is down. (or i think so at leased)

 

I can't figue out how to wire the write "text file" function to the "write to spreadsheet file" function, so i can have a text headder above my collums of data (in the same file).

 

Thanks Zac

 

 

 

 

 

 

 

 

0 Kudos
Message 9 of 16
(4,294 Views)

Like this.

Message Edited by Ravens Fan on 02-03-2009 11:16 AM
0 Kudos
Message 10 of 16
(4,282 Views)