07-25-2014 12:31 PM
Hi NI Community,
I'm trying to read data from a .csv file (saved from Excel) in LabVIEW 2013 and cannot understand why I keep getting the same error. I am using the "Read From Spreadsheet File" VI to accomplish this. I need to read in the data and store it in an array. When I try to compile and run the code on my myRIO, I get an error that says, "File not found. The file might be in a different location or deleted. Use the command prompt or file explorer to verify that the path is correct."
I have the file saved in the project folder with the rest of my files for this code, and that's the location I am giving to the Read From Spreadsheet VI. I am running LabVIEW on a virtual machine with a shared drive on my Mac, but I tried saving the .csv locally and it still didn't work. I was told it may have something to do with the fact that I'm running the code from the myRIO, not my computer where the file is actually stored, but I'm not sure. Even if that is the problem, I wouldn't know how to solve it. I have 3418 data points that I'm reading in, so I would really prefer to not have to manually put them into an array.
If anyone could help me figure this out, I would appreciate it immensely!
Best,
Emma
07-25-2014 12:38 PM
That file needs to be on the myRIO itself. It cannot just read stuff from your harddrive. It has its own.
Think of it as another computer and it all makes sense. You wouldn't expect another computer to get "C:\blah\temp.txt" and be able to read the file in that location on your computer. But you can make a shared folder on your computer and then another computer can read the files in that folder using the network address. This is the method I normally recommend to people to use. Make sure your myRIO is using the network address.
07-25-2014 12:38 PM
07-25-2014 01:21 PM
Thanks for both your responses.
I want to open the file on the RIO target because I need to read the points, then use them as position data to send to a motor that the myRIO is controlling. I already have the control software written, I just need to import the points so the motor knows where to go.
Does this mean I need the File Transfer Utility, in order to load the file onto my RT target? I'm currently referring to this document: http://www.ni.com/white-paper/3365/en/
Emma
07-25-2014 01:43 PM
I'd just use the Windows explorer FTP to put the file on the RIO. Or if you will always have your computer connected when doing this, make a shared drive on your computer that the RIO can access with a network address.
07-25-2014 02:25 PM - edited 07-25-2014 02:37 PM
Does myRIO need to be connected over wifi to do this? I just tried adding a network location in windows Computer, using ftp://<ip address> but am not sure if that's the right way to do it. Sorry, this is all very new to me.
EDIT: Figured it out. Needed to use Map Network Drive. Thanks so much for your help!
07-25-2014 02:57 PM
Right now I'm just trying to read in my data points and output them to a chart, that way I can see that things are working properly. So when I go into the files on myRIO, I should be able to paste the .csv I need to use there, correct? Then that's the file path I pass to the Read From Spreadsheet File VI? That's what I just tried and still got my original error, looking something like this:
07-25-2014 05:33 PM
The File Path Control on your front panel shows something like "/R/Forces...". This is a relative path to a folder called "R" -- is such a folder on your RIO? Where did you put the file on the RIO? I'm guessing the file is at "C:\<folder and path to files>" ...
BS
07-25-2014 05:58 PM
Not sure why I didn't think about his sooner, but here's a really good paper on file paths with the cRIO/myRIO.
Working with File Paths on Real-Time Targets
07-28-2014 09:57 AM
Thank you for the help. I'm now able to read in my data using the network drive I mapped to on my PC and the file path /home/lvuser/<myfile>.