LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathscript RT issue - jerky display when clf - plot in a loop, how do I fix it?

I get radically different presentations when I use the following code in MatLab R2014a and LabVIEW MathScript 15.0.1.  

 

How do I make the MathScript act more like the MatLab?

 

N = 35;

[X,Y,Z] = peaks(N);

figure

for(i = 1:N)
    idx = find(abs(Z(i,:)> 0.01));
    
    if length(idx)>0
        clf
        plot(X(i,idx),Z(i,idx),'.b-')
        legend('line','Location','NorthEast')
        title(['Iteration', num2str(i)])
        axis([-3,3,-10,10])
        drawnow
    end
end
0 Kudos
Message 1 of 6
(5,320 Views)

Here is a link on using the MathScript Node in LabVIEW:

 

Tutorial: MathScript and Forumal Nodes:

http://www.ni.com/white-paper/7572/en/

 

We would need more information about the difference in behavior you're seeing to help you further.

 

Alex C.

National Instruments 

Applications Engineering

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(5,266 Views)

So what I am getting from the answer is: display of plots in a static sense is very compatible, but in a dynamic sense is not.  Try and do your drawing using "plain-G" instead of MathScript to get more stable display. 

 

Am I missing the mark?

0 Kudos
Message 3 of 6
(5,264 Views)

Could I get some more information from you on what the differences in behavior are? Screenshots could be helpful, and a bit more description on what you're seeing. 

Rachael Dahlman
Applications Engineer
National Instruments

0 Kudos
Message 4 of 6
(5,251 Views)

Rachael,

 

MatLab:

single draw of figure

each loop updates internals, but does not change bounds

display is seamless

untitled.png

 

LabVIEW:

the figure flashes to a default size, draws a limited axis size figure, resizes axes every iteration

the clf looks to "close" the LabVIEW figure, not clear the display area. 

Capture.PNG 

 

The difference is that of useful vs. essentially useless. Notice also that the images displayed are not the same. 

 

 

0 Kudos
Message 5 of 6
(5,247 Views)

In your window, go to Help -> LabVIEW Help . This will open the LabVIEW Help window. On the left, expand the MathScript RT Module and then expand the MathSCript RT Module Functions. Some functions are a bit different than what you expect. When I looked, I specifically saw that clf is the legacy name, and is now clfig. I'd just go through there and make sure your functions are correct MathScript ones.

Secondly, I'd use the "Variables" tab in the MathScript tool to ensure that you're getting the correct data, and, if not, what function/area is generating incorrect data.

0 Kudos
Message 6 of 6
(5,236 Views)