LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

How to return struct from a MathScript function?

Solved!
Go to solution

Could someone guide me how to return struct from MathScript node if I have something like this in it:

[stat.mymax, stat.mymin] = mymaxmin(1, 2)

The script looks like this:

function [mymax, mymin] = mymaxmin(a,b)
%max min
mymax = max(a,b);
mymin = min(a,b);
end

And the code:

 Node.png

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 1 of 3
(4,346 Views)

It seems that output will not be automatically assigned because mymaxmin function is included in run time with addpath function...

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 2 of 3
(4,327 Views)
Solution
Accepted by topic author bienieck

To close the subject:

To be able to automatically assign output structure in a custom function I needed to set MathSript Search Paths: Tools > Options >MathScript > Search Paths.

From my understanding, it will never work with addpath() and in such case, I need to manually assign output data types (and I believe struct will not be an option).

Case closed.

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 3 of 3
(4,315 Views)