LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I most simply display and log CAN and analog signals to the same file (~5 to 20Hz)?

Sorry...forgot to add the pictures.....:)
Download All
0 Kudos
Message 11 of 13
(738 Views)

First of all, thanks again for your help.

 

Regarding the two pictures you showed for building the array - it doesn't seem to work that way since the arrays are of different dimensions. The TIn function gives one sample of one signal, while the CAN function gives one sample of 18 signals.

 

TIn, by the way, is a driver supplied by the manufacturer of the thermocouple input I am using (Measurement Computing).

 

I added time to the array to serve as "X Values" for the "Write to Meas File" function, but it still interpreted everything as rows, not columns. Obviously the Express VI is mean to take a waveform or previously constructed 2D array instead of a series of 1D arrays, however since my data sets are not a predetermined # of samples or amount of time, I don't see how to do this effectively.

 

I agree that using the Express VI is bad practice. I am limiting loop execution time with a delay. The problem I'm having is that I need to be able to run the main While loop so that I can view the instruments with or without logging. I then need to be able to turn logging on and record an indeterminate period of time while still watching the instruments. If I were to just continually build an array of data with the while loop and then call the express VI to write the file upon termination of the while loop, I would end up logging everything that happened while the program was running, not just the time period I needed. Also, wouldn't the array begin to take a lot of memory if I ran for a long time?

 

For now, I'm getting by with using "Write to Spreadsheet File" instead of the Express VI. I don't like that it is constantly accessing a file every iteration and I like some of the options on the Express VI, so I need to figure out eventually how to do it better. I've attached my current program. It works, I can view the samples on the chart fine, and the execution time is acceotable. However, I cannot put comments and headers on the beginning of the file.

 

Your comments are all appreciated and welcome.

0 Kudos
Message 12 of 13
(722 Views)

MainDish-

 

           There is unfortunately no cut and dry way to add headers to the Write to Spreadsheet File.VI. I use this method (see attached picture) to do it but it's not the best. Basically I concatenate all my strings (I used your method to show it) and then build it into a 1D array. I write the 1D array of strings to the spreadsheet file first and then pass the file path to the second Write to Spreadsheet File.VI where I append the data. You can wire in a true constant to the transpose data if you are still getting the rows and columns switched on this VI. Excel doesn't like it initially but when you force it to open, the header is there and is shown as delimited and the data gets added underneath it. It's not the best way, but it is a workaround. Let me know how it works for you. 🙂

0 Kudos
Message 13 of 13
(716 Views)