I have two task to do
- getting data serially from microcontroller.
- plotting the 3 axis value in real time.
For first I used the following code:
s=serial('COM10');
fopen(s);
out=fscanf(s);
while(out~=0)
out=fscanf(s);
disp(out);
end
fclose(s);
now in second part i have to plot there data in real time how can i do it ,m new to matlab i tried the following sample code to plot 3 values but didn't worked out. please help.
x = -50;
y = 10;
z = 20;
while(1)
plot3(x,y,z);
XLABEL('X Axis');
YLABEL('Y Axis');
ZLABEL('Z Axis');
set(gca, 'XColor', 'r', 'YColor', [0 0.5 0.5], 'ZColor', 'y')
x=x+2;
y=y+2;
z=z+2;
end