This widget could not be displayed.
This widget could not be displayed.

LabVIEW MathScript RT Module

This widget could not be displayed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with MathScript node

Hi!

I have following Matlab-code that works fine with Matlab, but when I try to use it with Mathscript node, it won't work properly. The inputs r, th and Z are 2D-arrays. The problem seems to be that "hold on" function won't work and when I try to display the contour within a polar axes, I get error: "-90052 occurred at Error in function polar at line 9.  You specified an invalid number of output parameters for this function". I'm just a novice at LabView and I appreciate if You can help me a bit.

 

[X,Y] = pol2cart(th*3.14159/180,r);
[XI,YI] = meshgrid(-1:0.01:1,-1:.01:1);
ZI = griddata(X,Y,Z,XI,YI,'cubic');
surf(XI,YI,ZI)
hold on
surf(X,Y,zeros(size(X)))
hold off
axis equal
h = polar([0 2*pi], [0 1]);
delete(h)
hold on
contourf(XI,YI,ZI,20)

 

Sincerely

Quizma

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 1 of 5
(7,436 Views)
What is your LabVIEW version? Can you attach a small VI containing typical data?
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 2 of 5
(7,435 Views)

LabView verison is 8.5.1

 

This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 3 of 5
(7,430 Views)
And with correct data...:
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
0 Kudos
Message 4 of 5
(7,429 Views)
Hello Quizma,

Unfortunately, your script exposes a few weaknesses in MathScript.  Currently, hold on doesn't work for 3D graphs (such as surf).  There is currently a bug report for this (id: 53392).  Also, the MathScript polar command does not produce any output.  This is why you receive the error you mention.  Remove the "h =" from line 9 of your script and then you can delete line 10.  In my testing with 8.5.1, there seems to be a bug in the griddata function when using the 'cubic' option.  It produces an array of zeros.  Try using the 'v4' option instead.  I have also tried your VI in LabVIEW 8.6.  It seems to hang with both the 'cubic' and 'linear' option, but works fine with the 'v4' option.  I have filed a bug report for this issue as well (id: 124923).

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
Message 5 of 5
(7,416 Views)