03-03-2009 03:27 PM
I've been wrestling with this one:
Mathscript vi with some csvread() statements (copied in from an old Matlab program I'm converting).
I run the vi and it generates a file not found error:
Error -90001 occurred at Error in function csvread at line 1. LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
=========================
NI-488: Nonexistent GPIB interface.
Of course before this I made sure to set the path using the Mathscript window options menu to the full path where the files are (and the files are there).
Here's the rub: if I open up the Mathscript window and cut and paste the exact code from my vi into the command line - it works perfectly - no errors.
I must be doing something wrong. Is there maybe a global LV project search path that needs to be set or something. BTW: it's weird that the error comes from NI-488 GPIB interface - I'm not connected to any hardware - it's a completely sw application right now.
Thanks in advance for any suggestions,
Tom
03-03-2009 04:18 PM
03-03-2009 04:24 PM
Is the path defined as a relative path (such as \subfolder\my file.csv) or as an absolute path (such as c:\LabVIEW\My Data\subfolder\my file.csv)? My guess is that it is a relative path and you have a different starting path in one context versus the other.
As for the GPIB message, some error codes are shared between LabVIEW and GPIB. Because you are not using GPIB, that part of the error message can be ignored and just pay attention to the LabVIEW version of the error code of file not found.
03-03-2009 04:52 PM
Thanks for the quick replies.
Just checked, the path is absolute (c:\documents and settings\me\my documents\my working directory).
Any other suggestions - Thanks,
Tom
03-03-2009 05:48 PM
I figured it out:
The offending line of code was:
tpl_p1r = csvread('tpl_p1r.csv','B2..C2');
I changed it to:
tpl_p1r = csvread('tpl_p1r.csv');
and then indexed the values I wanted in the array explicitly on another line: x = tpl_p1r(2,2);
Funny though - the original line works fine as I said before in the Mathscript window.
Oh well I found a bug but I got it working.
Thanks,
Tom
03-03-2009 07:37 PM
Strange.
I tried your line in LV 8.6.1 along with an example file I had created in the Mathscript node based on the csvread example in help and had no errors.
I'm glad you found a way around it.
03-22-2009 09:02 PM
Hello every one,
I got the same problem. I can not use csvread () comand with with Mathscrit.vi but it works on Mathscript window.
I run the vi and it generates a file not found error:
Error -90001 occurred at Error in function csvread at line 1. LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
=========================
NI-488: Nonexistent GPIB interface.
This is the simple script which I used;
data=csvread('a.csv');
t=data(:,1);
y=data(:,2);
plot(t,y);
03-23-2009 11:51 AM
Howdy Postdoc,
I assume you've checked into the path issue as well as parsing out the data suggested by the other two solutions to this thread. One additional suggestion I have is to import the .csv file outside of the mathscript window using the Functions Palette » File I/O » Read from Spreadsheet function. That way you can get all of your data into LabVIEW and feed the array directly into the Mathscript node. Please let me know if for some reason this will not work for you. Have a great day!
03-23-2009 07:21 PM
Dear Chris,
Thank you very much for your kind advice. I will try it and let you know.
Thanks again,
Have a great day,
Yours truly,
Ranjith Amarasinghe
03-24-2009 08:12 PM
Dear Chris,
First thanks for your advice.
BTW, I could solve it just adding absolute path.
The offending line of code was:
data=csvread('a.csv');
t=data(:,1);
y=data(:,2);
plot(t,y);
I changed it to:
data=csvread('F:\1MY-DATA\Labview\Mat\a.csv');
t=data(:,1);
y=data(:,2);
plot(t,y);
it worked,
Thank you very much, Chris
Have a great day!