From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-12-2013 09:33 AM
I would like to dynamically load a Matlab .m file into the Matlab Script function in a VI.
In other words, based upon a path to a .m file (control on the FP), load the .m file into the Matlab Script and then execute it.
Does anyone know how to do this?
Solved! Go to Solution.
02-13-2013 04:49 PM
Hi RedSoxFanatic,
It's not possible to do what you're asking. However, I can think of a couple options that will give you the same behavior.
1. If you only have a few of your .m files that will be called you can use a case structure with these files already loaded. The user can then choose which case to run.
2. You can have the Matlab Script Node run you particular .m file based on an input (number maybe), but this does also require you to have a predefined list of your .m files.
Justin D.
02-13-2013 05:20 PM
Thanks for the suggestions.
A coworker suggested dynamically loading a VI from a specific location. With a simple edit to the VI (new .m file) an application could dynamically load the VI and run the new .m file.
02-15-2013 03:18 AM
I have the exact need. I wonder if you can post your example VI code on dynamically loading the VI and running the new .m file
many thaks in advance
xg
02-15-2013 07:30 AM
I have not yet written the code.
However, there is not much to it. Use the "Open VI Reference" function that has a path to your VI with the Matlab Script in it. The VI will have inputs and outputs (must always be the same no matter what VI you dyamically load) that match the inputs and outputs to the Matlab Script. After the VI has run, close the VI reference.
02-15-2013 06:01 PM
many thanks. I will have a go.
xg
11-17-2015 03:22 PM - edited 11-17-2015 03:27 PM
I would like to point out that the chosen solution by the National Instruments applications engineer is unfortunately not correct. There are at least two ways that this can be done.
Hopefully this helps anyone who comes across this page! If someone could please unmark the current solution as correct, that would be great as well.
04-24-2019 04:38 AM
What do I need to install to have MLApp.DIMLApp accessible? How to find this ActiveX Class in the browser?
04-25-2019 02:27 AM
I installed Matlab Runtime and I guess I found the proper file here:
C:\Program Files\MATLAB\MATLAB Runtime\v96\bin\win64\mlapp.tlb
I was unable to find it in the list populated in "Select Object From Type Library" window. I needed to browse and manually select the mentioned TLB file.
I even registered it running:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regtlibv12.exe "C:\Program Files\MATLAB\MATLAB Runtime\v96\bin\win64\mlapp.tlb"
But I'm still getting error 3005 (no matter which Object I select).
How to fix the error and why Matlab lib need to be manually selected and registered?
04-25-2019 10:49 AM
Hi bienieck,
This would be a good topic for a new forum post since the initial topic here has been answered.
Thanks!
Ramsey
Technical Support Engineering
National Instruments