From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript does not execute m-function.

Good day everyone!

 

I am trying to implement a subVI containing a MathScript code which can read .dm3-files (Digital Micrograph format, here two outputs from dm3-file, the second is an image-matrix). I could download and run an m-function in Matlab environment (see ZIP for dmread.m with filename (test.dm3) and bgcorrornot=0 arguments) and it works (function is slightly changed from very original for convenience). The m-file, actually, contains 3 functions (the 1st calls other two).

However, I faced a problem when I tried to make it run in MathScript where I have a permanent error "The MathScript script is not executable. You must fix all errors with the script before this VI can run." 

First I thought i could be "try...catch: that cannot be properly executed but even when I removed it from the function (and it still could be executed in Matlab), it didn't work.

After (as far as I am not that good with MathScript) I thought that multi-functions in the m-file were the problem but it was not. I tried to split in different m-files all three functions. I feel that readTag-function also cannot be executed alone and had some parts in code that MathScript does not accept.

 

I would really appreciate if someone can point out the problem.

 

Thank you in advance!

ibonasa

 

P.S. Issues with a proper folder definition are also not a case. 

Download All
0 Kudos
Message 1 of 2
(3,492 Views)

Hi ibonasa!

 

When trying to use the same approach as you (after defining proper MathScript Search Folder), I get the same result as you. As there is obviously something in the dmread.m file that LabVIEW's MathScript cannot digest, I tried the following:

  1. Create an empty MathScript node.
  2. Copy&Paste the content of dmread.m into the MathScript node.
  3. Remove the function definition (first line) and the end of it (last line).
  4. Now the Syntax Checker gives hints on what LabVIEW cannot execute.

LabVIEW_2019-07-09_17-07-31.png

Actually, it's just a few lines that do not work:

  • The @ in the onCleanup line
  • The brackets in tags=struct(). Could work without?
  • try..catch, as you already found.

 

I hope this helps!


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 2 of 2
(3,425 Views)