LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

An internal error occurred while processing this Mathscript

Solved!
Go to solution

I have been trying to run a .m file while begins with a number of % 'commented" out statements to aid in program set up.  I get this error as above as "error in line 0 and then the internal error message. Please advise is this an issue using % or else where in the program?

 

Chuck 

0 Kudos
Message 1 of 9
(8,086 Views)
Solution
Accepted by topic author cek
Hello Chuck,

That error indicates there is something in your script that LabVIEW MathScript did not understand.  As such, it depends on the script you typed.  Is it possible to attach your script?  If not, you can try a binary search with your script.  Delete half of your script.  If the problem still occurs, the culprit is in the top half.  Delete half of the top half and reiterate.  If not, it's in the bottom half.  Add back in half of the text you deleted and try again.  After you identify where the problem occurs, you can try to simply the script by removing other lines that are not necessary for the execution of the problem line.  If you can then post what you have, I can investigate what is wrong.

One possibility that comes to mind is if you are performing replace indexing of the following form:
[vs(m, n) s] = foo(...);
That is, putting one of multiple return values inside of another matrix.  A workaround for this is to perform the following:
[a s] = foo(...);
vs(m, n) = a;

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 9
(8,084 Views)

HI GRANT,  I HAVE BEEN TAKING THAT APPROACH AND IT DOES HELP NOW I AM STUCK WITH USING THE EVAL FUNCTION AS I HAD WORKING FINE IN MATLAB. AS AN EXAMPLE, I INPUT THE FILE NAME, THEN USE EVAL TO LOAD THE FILE. EXAMPLE, 

DATAFILE=INPUT(' TYPE NAME OF DATA FILE IN SINGLE QUOTES    ')

EVAL (['LOAD',DATAFILE]);  

 

NOW IN MATHSCRIPT I HAVE NOT FOUND A SYNTAX THAT WORKS.

 

PLEASE ADVISE,

 

CHUCK 

0 Kudos
Message 3 of 9
(8,081 Views)

Cuck,

 

If you still need help with this, please go to the post options and undo "mark as accepted solution". Right now everybody thinks the problem is solved.

0 Kudos
Message 4 of 9
(8,027 Views)

I have tried to reverse the accepted and have not been able to do so.  What have I missed?

 

Chuck 

0 Kudos
Message 5 of 9
(8,024 Views)
Yes, it actually worked. 🙂 Maybe you need to wait for an internal server refresh, database update, or similar. 😉
0 Kudos
Message 6 of 9
(8,017 Views)
Hello Chuck,

To debug the eval command, it may help to try to execute exactly what it would.  Instead of calling eval, try printing the results of your string to ensure it is formatted correctly.  From what you typed, it looks like you will need a space after the 'LOAD' command.  That is, after inputting DATAFILE, see what the matrix
['LOAD',DATAFILE]
looks like.  This may not be proper syntax.

In addition, you don't need to use the eval command to load data from a programmatic filename.  You can use the functional form of the load command instead:
load(DATAFILE)

It looks like the load command does not like the single quotes around a filename.  I have found the following syntax to work (assuming data has been saved in MathScript to mydata.mlv):

load mydata
load 'mydata'
load('mydata')
datafile='mydata', load(datafile)


Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 7 of 9
(8,010 Views)

Am I to understand I can not use a eval function to load a .mat file? Or an .txt file? This it must be saved in a mlv format?

 

Thanks

 

Chuck 

0 Kudos
Message 8 of 9
(8,003 Views)
Hello Chuck,

That is not the case.  The load function can read .mat files as long as the data in the .mat file is compatible with LabVIEW MathScript types.  For example, the load function will not be able to read cell arrays or structures from a .mat file.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 9 of 9
(7,973 Views)