LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

custom file name

Solved!
Go to solution

Hello! I'm trying to have it so that my data will save to a excel file with the custom naming parameters I put on the front panel. I have this code but when I stop the program, I get the error message that I attached below. I've also attached a picture of the part of my code that I believe is the problem. Any guidance would be appreciated! 

Download All
0 Kudos
Message 1 of 7
(170 Views)

We cannot tell from a truncated picture, for example what are the values of the various string controls? Do they contain any character not allowed in filenames?

 

(Saving after the toplevel loop is problematic in general, because if it fails, all data is lost. I recommend a proper state machine instead)

0 Kudos
Message 2 of 7
(161 Views)

The values are just numbers. The only aspect of the code that is missing from the photo is the waveform chart and DAQ Assistant.  

0 Kudos
Message 3 of 7
(157 Views)

There are many things "questionable" in the incomplete picture of code you presented.

  • LabVIEW "knows" about several different types of files, as hinted on the File I/O Palatte.  The two "basic" file types are "Text" (.txt) and "Binary" (.bin) files.  Text files are inherently "human-readable", and Binary files are definitely not as easily read, as the represention consists of the data as stored in the computer's memory.  There are other "structured" data formats that LabVIEW uses (such as TDMS.
  • While it is not a "universal" standard, files whose extension is .txt are generally Text files, readable by NotePad and other programs.  Files with the extension .xlsx are assumed to be Excel files, normally ready by Excel (though with the Report Generation Toolkit, LabVIEW can also read and process them).
  • Your code creates a file with what seems to be a very complicated name that includes a number of parameters probably related to the data within the file.  That makes the file name very complicated, and places the burden of figuring out the name (so you'll know how to process it) also complicated.  Perhaps a better way is to have, as the initial entries in your data file, a Parameter table, which could take the form <Parameter Name> <Unique Separator> <Parameter Value> <end of line>.
  • It really helps (you, and anyone trying to read your code) to use the Error Line (and keep it horizontal and straight) and use it to connect functions with Error In and Error Out.  This will help you find the function that first puts "True" (= Error!) on the line, which tells you which function failed.  I'm guessing it was "Create File", but it could have been any of the succeeding (and "higher-on-the-page" File I/O functions.  Do you know how to slow things down (or "look at the contents of wires") to locate where the error is occurring?
  • Seeing the LabVIEW code (hint -- file extension = .vi) would certainly help (we could "clean up the code" and see where the wires are running).  However, you may be using LabVIEW 2025, which many of us (like myself) haven't yet installed, so to share your .vi with us, open it, go to the File menu and choose "Save for Previous Version", specifying, say, LabVIEW 2019 or 2021 (most-often requested).

Bob Schor

Message 4 of 7
(131 Views)
Solution
Accepted by lost101

Your path has problem.

It should look like:

C:\Users\your username\desktop\your filename

 

George Zou
Message 5 of 7
(127 Views)

@zou wrote:

Your path has problem.

It should look like:

C:\Users\your username\desktop\your filename


I did not want to make any assumptions about the user hierarchy, because someone could potentially create a root folder name "Desktop" if they try hard enough. 😄

 

In particular, if you want to save on the desktop (not a good idea in general because it will most often behind a window!) you should use this function.

 

altenbach_0-1751572530377.png

 

0 Kudos
Message 6 of 7
(117 Views)

THANK YOU SO MUCH! It's always the small things I mess up. I feel really dumb now. 😛

0 Kudos
Message 7 of 7
(107 Views)