LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to log analog signals from crio in excel

Hi,

I am to write a program that can log analog signals recieved from a compactRIO in an excel file but with very little experience in Labview I don't really know how to start. Right now I'm focusing on designing a program that can first and foremost log a manual input in excel and when that works I'll adjust the program to log analog signals instead. But I'm having little success. Any tips are welcome

Thanks in advance

0 Kudos
Message 1 of 6
(1,064 Views)

Hi Lindborg,

 


@Lindborg wrote:

But I'm having little success. Any tips are welcome


What have you tried so far?

Where are you stuck?

Why don't you attach your VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,049 Views)

Hi GerdW,

Thank you for your reply. To start off I've been following this tutorial https://www.youtube.com/watch?v=nRWMzxqZJaM

as it seemed to be a good way to log manual inputs. However when i open the excel file connected to the program it says the file might be corrupted. From what I've read on this forum the problem is either that the file xlxs is not supported or that the block 'write to spreadsheet' is not meantr to be used in the way it is in my code. However it worked flawlessly in the tutorial. 

Attached is my VI. Thank you

 

0 Kudos
Message 3 of 6
(1,023 Views)

There are two types of "spreadsheet" files.  One type are properly called "Excel" files, as they are defined by the Microsoft program "Excel", and use the proprietary formats ".xls" and ".xlsx" (and a few other similar extensions).  These files include a lot of "non-data" properties, such as the ability to embed formulas, graphs, "coloring" of cells, etc.

 

The other type are ordinary text files organized in rows and columns, with rows separated by (ordinary) Line Returns (typically, on the PC, the sequence <CR><LF>), and columns separated by a "Separator Character", usually a comma or <tab>.  These "formatted columnar files" have been given the name "comma-separated values", and have a default extension, .csv (even if the column-separator is <tab>).  Microsoft helps confuse the issue by providing an icon for .csv files that looks like the one for "true" Excel files (.xlsx).

 

LabVIEW provides two functions, "Write Delimited Spreadsheet" and "Read Delimited Spreadsheet", that can handle the pure-text .csv files.  It also has an Add-on, the Report Generation Toolkit ("RGT"), that can actually open Microsoft Excel (if you have it installed) and use it to open .xlsx files and provide you access to the data inside the file.

 

You can not open true Excel files (.xlsx) with the "Delimited Spreadsheet" functions.  The Tutorial you viewed (where it "worked flawlessly") probably used a version LabVIEW that included the RGT.

 

I just looked at the video that misled you!  The presenter used Excel to display a simple text-only Spreadsheet, one row having text headings and the remaining rows having numeric data.  I didn't listen carefully to the video, but if he actually used that file, he needed to save it as a "non-Excel" .csv file, which he could open (or create) with LabVIEW's Delimited Spreadsheet functions.  When you open a .csv file in Excel (which does work!), you can edit it, change it, but need to save it in the .csv format, and ignore Excel when it asks you to save it as a true Excel file.

 

Bob Schor

0 Kudos
Message 4 of 6
(1,016 Views)

Thank you Bob for your very detailed reply. To sum up the program from the tutorial is not compatible with .xlsx files but .cvs. That set aside, would you say the program is a good base for logging analog signals or should I be looking to create something else entirely? Right now I'm hoping I'll be able to somehow put my signal input inside of the case structure inside of which the tutorial has the random number generator.

Thanks.

0 Kudos
Message 5 of 6
(1,007 Views)

When learning, the K.I.S.S. Principle (Keep It Simple, Sam) makes sense.  Using a Delimited Spreadsheet means the output is Human-readable (don't use this if you are taking MHz signals!) and lets you "see" the data easily ...

 

Bob Schor

0 Kudos
Message 6 of 6
(981 Views)