LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lab use write spreadsheet

I need some help writing to a spreadsheet. I’m working on the following example https://forums.ni.com/t5/Example-Code/Dorm-Room-Alarm-System-Using-a-PIR-Motion-Detector-Speakers/ta...

 

for part 8, write to spreadsheet, I can’t get it to work. I add the vi into the loop( it’s the write to delimited spreadsheet vi) but it won’t recognize any file.  When I run without a file location and it prompts me to pick a file, nothing is selectable. I end up just closing the screen and getting error 43. Any hep would be appreciated. 

0 Kudos
Message 1 of 12
(4,521 Views)

Hello,

i hope to help you with the pour information that you give us.

I think that you wire a control file path with the property to select a folder. For this reasono you are not able to select a file or write the name of new one. The error 43 is because you didn't select a file (in other words the field is empty).  

0 Kudos
Message 2 of 12
(4,509 Views)

Your pdf attachment is broken (file name probably contains reserved characters). It would help to attach your VI instead anyway. try it.

0 Kudos
Message 3 of 12
(4,493 Views)

attached is my VI. I got it to run but it only returns one value in the .csv file. I'm not sure what's wrong with it. 

0 Kudos
Message 4 of 12
(4,469 Views)
  • If you need to change the frequency during the run, the simulation belongs inside the while loop.
  • Your use of dynamic data makes things more difficult.
  • Does the file in the path diagram constant exist? Is it already open in e.g. another application and thus locked (excel, etc.).
  • You are constantly overwriting the same old data to the same old file. Wouldn't once be sufficient?
  • What determines the loop rate (sorry, no DAQ here, so I cannot check your express VIs).
  • Can you explain in more details how you are running this, how you interact with it, and what you expect to happen.
0 Kudos
Message 5 of 12
(4,460 Views)

The data I need recorded is the every time the motion sensor/alarm goes off. It’s fine if it continually writes over the old file, i just need to show it collects the data and exports it to a file, which unfortunately it’s not doing. 

0 Kudos
Message 6 of 12
(4,457 Views)

Here is a link for the actual setup and explanation of how it works. The bottom of that page, section 8, is where it mentions adding the export data function. 

 

https://forums.ni.com/t5/Example-Code/Dorm-Room-Alarm-System-Using-a-PIR-Motion-Detector-Speakers/ta...

0 Kudos
Message 7 of 12
(4,456 Views)

Well, you slavishly copied the code that NI provided in the example you cited, but when it came to the Export Data section, you chose to "do something else".  Here is what it says:

  • You can modify the VI to log the each intrusion time to file using a ‘Write To Spreadsheet File.vi’ express VI if you wish to record the alarm times.  Be sure to place it in the loop and be sure to append new data to the spreadsheet file.

You did not use "Write to Spreadsheet File.vi" Express VI.  This is actually a good thing, as Express VIs are often a "crutch" that inhibits learning LabVIEW.  But the second sentence, which ends "be sure to append new data to the spreadsheet file", you ignored completely.  Right-click the Write Delimited Spreadsheet function you are using, and read the Help.  Do you know about Shift Registers?  [I think "probably not"].  If not, go find some LabVIEW Tutorials (start at the first page of this Forum and look at Learn LabVIEW Basics).

 

Bob Schor

0 Kudos
Message 8 of 12
(4,439 Views)

Bob, 

Just to be clear, I by no means 'slavishly' copied this with any attempt to pass it off as my own. My assignment was to complete this example, and by performing it, you will see that in reading the instruction step by step you physically copy the .png file with the block diagram. 

 

The reason I did not use the 'write to spreadsheet.vi' as stated in the instructions is that it's not an option in my version of labview. My system only lists 'Write to delimited spreadsheet'. I did double click to open the settings and checked the box to append the data. If there was something I ignored it's because i'm not sure what to do, hence why i'm on here looking for assistance. 

 

thanks for the "help". 

0 Kudos
Message 9 of 12
(4,433 Views)

The name changed to "Write Delimited Spreadsheet" when NI added the Error Line to this function.  You still need to make sure the "Append" input is True on all but the first run, which you can do with a Shift Register (wire a "True" to the right-inside side to turn it True for the "next" iteration).

 

Bob Schor

0 Kudos
Message 10 of 12
(4,430 Views)