From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

problem executing mathscript

Hello i am trying to run the next code in labview 8.5 and i know this code is good because I executed in matlab and everything was fine, but in the line where say "axis" labview say "Error 90046" and i dont understand the reason. Somoene knows what is happening? labview can't run 3D map with mathscript?


n=500;
x=[20,4,6];
 y=[10,8,90];
 z=[16,2,50];
 color=rand(n,3);
 hold on
 axis([min(x) max(x)   min(y) max(y)      min(z) max(z)])
 for i=1:length(x);
 plot3(x(i),y(i),z(i),'*','color',color(i,:))
 axis([min(x) max(x)   min(y) max(y)      min(z) max(z)])
end
axis([min(x) max(x)   min(y) max(y)      min(z) max(z)])
xlabel('X');
ylabel('Y');
zlabel('Z');
view(36,18)
grid on
hold off

0 Kudos
Message 1 of 2
(4,823 Views)

There are several issues in your code.

1. The first call to axis returns error since there is no 3D plot at that time.

2. hold does not work on 3D plot.

3. plot3 can not accept 'color' attribute.

 

The following updated code works on LabVIEW 8.6.

 

n=500;
x=[20,4,6];
y=[10,8,90];
z=[16,2,50];
color=rand(n,3);
plot3(x, y, z, '*')
axis([min(x) max(x) min(y) max(y) min(z) max(z)])
xlabel('X');
ylabel('Y');
zlabel('Z');
view(36,18)
grid on

0 Kudos
Message 2 of 2
(4,782 Views)