LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript bug with 3D zeros in LV2012?

Solved!
Go to solution

Hi all,

 

There seem to be an issue with 3 dimensional 'zeros' method in the mathscript module?

 

The documentation from Matlab gives the following example:

 

3-D Array of Zeros

Create a 2-by-3-by-4 array of zeros.

X = zeros(2,3,4);

size(X)

ans =

     2     3     4

 

However, in LabVIEW I get a broken arrow:

 

ZerosError.JPG

 

Is this some known limitation in the mathscript module or perhaps a bug?

 

Best regards,

 

/Roger

 

 

0 Kudos
Message 1 of 5
(2,649 Views)
Solution

Hi Roger,

 

you should consult the MathScript help instead of Matlab...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(2,648 Views)

How is this an acceptable answer? I thought part of Mathscript draw was that it could interpret and execute most MATLAB code that didn't use external toolboxes and such.

 

zeros(i,j,k) is a pretty straight forward function. Not supporting it makes me wonder what other rudimentary functions aren't supported in Mathscript...and I'm VERY pro LabVIEW for a lot of things that MATLAB is equally (or more) capable of...

0 Kudos
Message 3 of 5
(2,433 Views)

Mathscript != Matlab, but it shares similar syntax and will be able to run most plain matlab code (i.e. no special tooolkits, etc). Mathscript datatypes are limited to scalar, 1D, and 2D arrays, as documented e.g. here). The nice thing is that it runs on any LabVIEW or LabVIEW real-time target.

 

There are other programming tools that use matlab-like syntax, e.g. octave, scilab, etc.

 

IMHO, Mathscript is for quick incorporation of e.g. legacy matlab code into a LabVIEW program. If you try to write code from scratch, I strongly recommend pure graphical code. It will be much more efficient and flexible.

 

You can also use the matlab script node, of course, but that requires a matlab license (which you might already have). I think there are also ways to create a dll from within matlab, which can then be called from LabVIEW, of course.

0 Kudos
Message 4 of 5
(2,427 Views)

I know Mathscript is distinct in implementation from MATLAB, I'm just really surprised at the limitation of data types...i.e. no 3D structures. I guess the limitations have never been explained to me, and I've never run into issues since MOST of my code is native LabVIEW, but a colleague writes a lot in MATLAB and I figured most generic non-toolbox specific code would work.

 

Don't get me started on MATLAB DLLs...that is a disaster in and of itself...

0 Kudos
Message 5 of 5
(2,423 Views)