Jump to content

Dynamically calling Mathscript .m file in EXE


Recommended Posts

I have a request to make an EXE be able to dynamically call a .m file with Mathscript.   The .m file is User supplied and not knowable at build time.   But my understanding is that the EXE compiles in the Mathscript, so this cannot work, and that other dynamic mathscript options (such as “evalâ€) do not work in an EXE.  Has anyone encountered this issue before? 

Link to comment

I have a request to make an EXE be able to dynamically call a .m file with Mathscript.   The .m file is User supplied and not knowable at build time.   But my understanding is that the EXE compiles in the Mathscript, so this cannot work, and that other dynamic mathscript options (such as “evalâ€) do not work in an EXE.  Has anyone encountered this issue before? 

 

Yes, when developing the LabPython interface which also has an option to use a script node. That is why I then added a VI interface to LabPython which made it possible to execute Python scripts that are determined at runtime rather than at compile time. However not sure how to do that for Mathscript.

Link to comment

So I've never done this exactly as you need, but I have loaded simulink models into Veristand, and prototyped using these compiled model in LabVIEW using the Model Interface Toolkit.  Here's a few links.

 

http://digital.ni.com/public.nsf/allkb/0DCC5D6CFFBED96886257DFE00626859

http://zone.ni.com/reference/en-XX/help/374160A-01/vsmithelp/mit_convert_model_to_dll/

 

I don't know the full workflow, but you could have a user load a .m file in your software, which runs command line tools which compiles it to a DLL that can be loaded with this toolkit.  Probably a decent amount of work.

 

Or maybe it is an option to have the full LabVIEW development environment on this PC where you could perform scripting to make the Mathscript node, import the .m file, and save it as a VI that is then loaded into your EXE.  No idea if importing a .m is exposed as a scripting method or not.

Link to comment

The workflow/setup is:

— User has my EXE and takes calibration data with it (no LabVIEW Dev environment installed)

— imports data into “Eigenvector Solo†3rd-party App to do advanced calibration

— â€œEigenvector Solo†outputs a .m file

— my EXE imports and runs .m file on new data.

 

It’s the last step that I think can’t be done, because the EXE can’t dynamically load and compile a .m file.

Link to comment

How sophisticate are the .m constructs in the output file? If they are basic, like variable assignments, and if the are consistently patterned, perhaps an ad hoc text scan can do. And if they are just a bit more complex, e.g. they involve some arithmetical and mathematical functions, they may be passed with minimal transmutations to formula nodes.

Formula nodes are in my experience somewhat slow, but if manual exporting steps are involved, the parsing delay may be negligible..

Link to comment
  • 4 years later...

Hello there,

Exactly the same problem trying to call dynamically a .m script from a LV exe in LV 2017 (so it is run in the MathScriptNode). It works using the IDE but not as an exe. Has there been any changes from NI on this? Thx.

Note: guessing no, as the .m files are interpreted & compiled at build time since the interpreter is not included in the run-time engine...

Edited by LDBM
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.