clc;
close all;
clear;
workspace;
format short g;
format compact;
fontSize = 13;
numPoints = 100;
points_x = rand(1,numPoints) - 0.5;
points_y = rand(1,numPoints) - 0.5;
points_z = rand(1,numPoints) - 0.5;
psize = 40;
points_col = zeros(numPoints, 3);
allPosIndexes = points_x > 0 & points_y > 0 & points_z > 0;
points_col(allPosIndexes, 2) = 1;
allNegIndexes = points_x < 0 & points_y < 0 & points_z < 0;
points_col(allNegIndexes, 1) = 1;
oldPlot = scatter3(points_x,points_y,points_z,psize,points_col,'filled')
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
Best Answer