I would use the following syntax for scatter3
Note that if C is a vector with length equal to the length of X, Y, and Z, then the values in C are linearly mapped to the colors in the current colormap.
Convert out into a vector using the colon operator: C = out(:);
To work, X, Y, and Z will have to be the same size as out. You can use meshgrid for that.
Here's a simple example. Note that the color of the markers has nothing to do with their x,y or z locations. It is coming from C.
scatter3(x(:),y(:),z(:),[],C(:))
2 件のコメント
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718125-plot-a-3d-domain-with-colors-determined-by-3d-array#comment_1266050
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718125-plot-a-3d-domain-with-colors-determined-by-3d-array#comment_1266050
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718125-plot-a-3d-domain-with-colors-determined-by-3d-array#comment_1266155
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/718125-plot-a-3d-domain-with-colors-determined-by-3d-array#comment_1266155
サインインしてコメントする。