I have been trying to write a file path so that I can create a tdms file to write data to.
The problem is that when I start to type the path namely:
the file path indicator adjusts it to:
/C/Users/RMC/Documents/LabVIEW Data/0112/hello.tdms (Though when copying this it changes back to the original).
I have tested this on other VIs and other projects and this does not occur.
My goal is to write a tdms file however it will not open the file as it says that it cannot be found (Error 7 occurred at TDMS Open in Events.vi LabVIEW: File not found. The file might be in a different location or deleted. Use the command prompt or the file explorer to verify that the path is correct.) and this is the only reason thing I can see that is different from the other VIs. I also dont understand why it says that the file cannot be found as I have set TDMS Open to create one not open one.
Please help 🙂
Solved! Go to Solution.
The path constant is a special type of string which adapts the path separator (e.g. / or \) on different operating systems and can also identify relative versus absolute paths.
Generally it is better to use the path functions like build path / strip path from the file I/O palette than to use strings.
Can you show us your code (upload the VI or take a screenshot) where you use the path so we can see what you might be doing wrong? Also, your code is under 'my computer' and not running on a different target, right?
Can you show us your code (upload the VI or take a screenshot) ...
If the code is more than 3-4 functions, do not submit a "screenshot" (unless it is an executable LabVIEW Snippet). The reason to post code is so that we can "try it ourselves" -- the best is a VI, as we can (a) open it in LabVIEW and run it, seeing what it does and modifying it so it "does it right", and (b) it allows us to figure out which version of LabVIEW you are using and return "fixed" code that will run on your machine.
I am adding a screen shot of the snippet of code. I created the tdms file hello using another VI (just to test that it is possible). I am just trying to send it a simulated signal to see if it can open and write into the tmds file:
I have tested further and my problem only occurs when the project is open, when I create a VI in the project it does not work. If I close the project and open only the VI it works.
You have the VI listed under an RT target and not 'my computer' - hence why I asked about that. It's trying to access the C:\Users\RMC......folder on the target, which doesn't exist. You need to save the file to a valid folder on the target or run the VI under 'my computer' by moving it in the project. The /C/Users format of paths is used on RT targets. When you open 'just' the VI, it always runs on your computer - you'll probably notice the path changes back to a windows path (e.g. C:\Users\RMC....).
Bob: I personally prefer screenshots in a lot of cases, it saves me downloading a VI, having to open it in a version of LabVIEW (I might not have installed) and quite often I can see what's up just from the picture. Of course, the ideal is both I don't have LV2015 installed so when I downloaded the VI, I then couldn't open it - so I can't do anything to help, at least with a screenshot there's a chance I can see what's wrong just from the picture, or on my phone etc. It's just a personal preference thing I guess.
your cRIO cannot access the harddrive of your PC! That's it...
You need to think of your cRIO as another computer. You don't expect your coworker's computer to access a file on your computer, do you? At least not with "C:\". Typically, you will want to make a Windows application as well that can get data from your cRIO and save the data.