LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript function error

Dear all....I'm quite new to LABView and all the more greener in embedding MATLab .m files within LABView. I've been having problems trying to decode what is wrong with my code and have been wondering if it is a limitation of LABView MathScript although everything is running perfectly fine in MatLab. Basically, what I am trying to do is to embed a .m file into my custom LABView application. The .m file has commands to extract decimal data from another file. To give you a clearer picture, my code is as follows:

 

See attached file for the code.The error message I keep getting is "Error90001 occured at Error in function feof at line 2. A problem occured with a subVI call". I attempted to comment out the while loop & end command but then it will complain the same message just indicating that error has occured with feof.

 

 Any help (esp. gurus) is much appreciated. Thanks

0 Kudos
Message 1 of 7
(7,324 Views)

kilo5k,

 

I believe your problem may be related to dangling file references. Your code has a fopen, but does not have a corresponding fclose. I suspect that the file gets opened the first time you run, but then cannot be reopened on subsequent runs. If you add fclose('all') to the beginning of your script, I believe your script may work, assuming that the file 'C:\work\demodata1.m' exists.

 

You may want to take a look at the function Read From Spreadsheet File.vi, it might be an easier way to accomplish what you are trying to do.

 

Best of luck,

Kevin C.

Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

0 Kudos
Message 2 of 7
(7,318 Views)
Tks...I'll take a look at your suggestion and input the results whatever the outcome...

Perhaps another question to ask...i noticed that if i were to incorporate more commands for calculations in my MatLab file, my computer somehow begins to slow down. I'm using LABview 8.5 and have 3GHZ processor with 2GB RAM. was just wondering if this is h/w limitation (dun suppose so) or just is it just LABView?
0 Kudos
Message 3 of 7
(7,309 Views)

What aspect of your computer specifically is slowing down? If you post an example I can take a look at it.

 

Kevin C.

 

0 Kudos
Message 4 of 7
(7,300 Views)
Its on the part after you click on the "tick" button and subsequently the "run" button. It is at this stage that the computer pauses for ~1min before running the simulation.
0 Kudos
Message 5 of 7
(7,284 Views)

Could you please attach the program you are talking about so that I can take a look at it?

 

Thanks,

Kevin C.

0 Kudos
Message 6 of 7
(7,273 Views)

Hi KevinC, have been racking my brains out on this problem and I seem to have solved it.All along, the MathScript node (formulas+file_handling) were within a while loop. As such, I must have made the LABView compiler confused. I had also reverted back to an earlier version of the file I was working on is fine now. Managed to get the LABView compiler unconfused by putting the filehandling sections of the MathScript node outside the while loop.Many tks for being of assistance...

0 Kudos
Message 7 of 7
(7,255 Views)