02-24-2017 09:54 AM
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
02-27-2017 09:28 AM
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
02-27-2017 09:34 AM
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?
02-28-2017 01:11 PM
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
02-28-2017 01:22 PM - edited 02-28-2017 01:27 PM
Rachael,
MatLab:
single draw of figure
each loop updates internals, but does not change bounds
display is seamless
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.
The difference is that of useful vs. essentially useless. Notice also that the images displayed are not the same.
03-01-2017 12:33 PM
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.