LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

record measurements in an Excel file

I made this program to test your method , I don't know where is the problem but it doesn't work 😕

0 Kudos
Message 11 of 12
(849 Views)

Here is a revised Snippet of my code, along with some comments about your code.  This is a Snippet -- if you save it as a .PNG, open LabVIEW 2014 and drag the PNG to the Block Diagram, it will magically become code -- you can run it, save it, modify it, etc.  And it works!

Revised Date and Time Example.png

There are numerous problems with your code (not the least of which is that you failed to follow my exampleSmiley Sad).  The problem with your attempts to save to a file is that you were forming an illegal file name by appending goodness-knows-what to the end of a fully-formed .xlsx filename.  See this example which shows how to insert a date-time string (formatted as 19-05-15 10-23-38 to avoid "bad" punctuation marks like slashes and colons).

Comments:

  • Your code never seems to stop, so it doesn't surprise me that you never write to the file.  Principle of Data Flow says you need to finish the While loop before you can execute the Save Report function.
  • Every time through your While loop, you are rewriting the entire (grwoing) table to Excel.  When your table has 1000 rows, you will be trying to write 1000 (then 1001, then 1002) rows to Excel twice a second.  Better is to write only the most recent row, and to do it once (as my code does).
  • Format Time does not need Current Time wired to it -- it is the default.  I added a Format string, as my local Time Code gave me illegal file characters.
  • I didn't try your code, so I don't know how it handled writing both the (ever-growing) Table and the Time.  My code allows you to explicitly write and position both as you wish (the "Choice" switch affect this -- once you make your choice, you can remove the switch and use the wiring that is appropriate).
  • It is generally considered a Bad Idea to use the Admin account (and logon), as this makes your PC much more vulnerable to outside hackers.

If you have questions about my code or why I did something a certain way, feel free to ask, and I (or someone else) will be happy to answer.

 

Bob Schor

0 Kudos
Message 12 of 12
(816 Views)