LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error running MATLAB function on LabVIEW (it works on MATLAB)

Solved!
Go to solution

Hello,

 

I want to run a game (that I did not write) in LabVIEW which is all programmed using MATLAB. It runs on MATLAB but I have no clue why it does not run on LabVIEW. Please take a look at the attachments to see the error, VI and game.

 

Note: I tried running other simpler .m functions that also call outside functions in the same folder using the same VI and they work so it is not the MathScript Node. Also, I already changed the search paths for the MathScript Node therefore the root of the problem is not there either.

 

Thank you!!

Download All
0 Kudos
Message 1 of 7
(4,178 Views)

Hello,

 

When using the MathScript RT Node you should enter your m code into the Node itself.  Have you tried taking your code from the Missile Commander file and putting it in the node?  Are you using any funtions that are on the unsupported list?

 

Below are a few resources on getting started with the MathScript Node.

 

Getting Started with the MathScript RT Module

LabVIEW Help: MathScript Node

MathScript RT Module Functions

MathScript Functions Not Supported in the LabVIEW Run-Time Engine (MathScript RT Module)

 

Regards,

M. Whitaker
ni.com/support
0 Kudos
Message 2 of 7
(4,056 Views)

Hi,

 

If you have MATLAB and just want to call the 'Missile_Commander' function from LabVIEW, you could use the MATLAB script node instead of the MathScript node by using 

 

run 'Missile_Commander_function_file_path'

 

BR
0 Kudos
Message 3 of 7
(4,027 Views)

Hi M. Whitaker,

 

Thank you for your reply. Yes, I have tried putting the code directly in the node and it did not work either. I am not using functions on the unsupported list (which I did not know about so thank you for the heads up).

 

If you have any other suggestion please let me know,

glovato

0 Kudos
Message 4 of 7
(4,002 Views)

Hi BR,

 

Thank you for your reply. Using the MATLAB script was my first attempt but had to abandon it because it does not allow me to call functions, only run scripts.

 

If you have any other ideas please let me know,

glovato

0 Kudos
Message 5 of 7
(4,000 Views)
Solution
Accepted by topic author glovato

In LV 2014, I can, without any error, call the function Missile_Commander.m from MATLAB script using the 'run' command.

 

code_snippet.png

BR
0 Kudos
Message 6 of 7
(3,963 Views)

Hello BR,

 

Thank you so much for your help. It worked!

I had to upgrade my LV version and modify the path that I was using to call the function.

 

Have a nice day,

glovato

0 Kudos
Message 7 of 7
(3,932 Views)