04-08-2025 06:25 PM
Hey everyone,
I am having trouble with a homework problem. The question I am doing is asking to create a VI that logs a time-stamped numeric value to a spreadsheet file whenever a Save button is pressed.
The issue I’m running into is with file handling: my VI only works if the specified file already exists. I need to make sure the VI can also create the file if it doesn’t exist, but I’m not sure how to do that properly. Looking to get some pointers / some help with how to do this if possible.
Any help is much appreciated!!
TIA 🙂
(Note: Saved for LV 2016 + screenshot of block diagram)
04-08-2025 08:14 PM
Did you know that LabVIEW ships with a bunch of "Examples"? Open LabVIEW, click Help, click "Find Examples". You should be able to find a few that will give you some ideas. Also, if there is an item on a Palette, say the "File I/O" Palette, whose function you don't know, drop it on a Block Diagram, right-click it and read its "Help" entry. Pay attention to the Examples it suggests.
Have you talked with your Professor, or fellow students? Things you work out for yourself will "stick" with you longer.
Bob Schor
04-09-2025 01:36 AM
Hello,
first things first: your while loop hasn't a time control. This consumes a lot of CPU. Connect the iteration variable to an indicator and have a look how it grows o_O.
Actually, although your code can be improved and simplified, it works fine even if the file doesn't exist (I also added the time control).
Improvements: think about putting your code in an event structure.
04-09-2025 12:21 PM
There is plenty wrong with your VI.