LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Importing data from a text file with MathScript

Hi,

 

I currently have a bit of Matlab code that imports a load of data from a tab-delimited text file. The text file is in the same directory as the .m file and my .vi file. The relevant line of import code from Matlab is:

 


data=dlmread('data.txt','\t',5,0);

 

When I run this in Labview after importing the code into a Mathscript block and connecting two relevant outputs to a "Build XY Graph" block such that the variables can be plotted, I get a message saying:

 

"Error -90001 occured at Error in function dlmread at line 10. Labview: File not found..." 

 

 

How can I get LabVIEW to read the file? Sorry if this is a stupid question but I'm new to LabVIEW, having come from Matlab! 

 

 

Thanks for the help 🙂 

0 Kudos
Message 1 of 5
(7,450 Views)
Sorry, forgot to mention... line 10 is the line in which the above-mentioned bit of code occurs. The rest is simply comments and a 'clear all' line.
0 Kudos
Message 2 of 5
(7,449 Views)

Hi,

 

Looks like that you are using relative path. Then, the file must be located in MathScript search path. Otherwise, MathScript can not find that file. You can either specify the absolute path or add the path to MathScript search path list.

 

I have tried in LabVIEW 8.6. dlmread should work well to read data from .txt file.

Message 3 of 5
(7,446 Views)

Hi,

 

Thanks for the reply. I also tried putting in the path as dlmread('C:\My Documents\...\data.txt') and it still wouldn't find it... is that what you meant by the absolute path? 

0 Kudos
Message 4 of 5
(7,436 Views)

Hi,

 

I have no idea why it does not work on your machine. Would you please attach your script and data file?

And, which version of LabVIEW do you use?

帖子被ttrr在 11-23-2008 07:21 PM
时编辑过了
0 Kudos
Message 5 of 5
(7,427 Views)