I want to use plot

1 回表示 (過去 30 日間)
Tomas
Tomas 2014 年 1 月 26 日
コメント済み: Azzi Abdelmalek 2014 年 1 月 26 日
Hello, i want to describe 10 points, I want to use function plot3.
I have 10 points save to cell Z. one point have the coordinates[x,y,z], but I can have a multi-dimensional space. I want to make it work multidimensional space[x,y,z,k,l,m,n]
for example:
Z =
{1x1 cell} {1x7 cell} {1x2 cell}
Z{1}= [1x3 double] - has one point
Z{2}= [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] - has seven points
Z{3}= [1x3 double] [1x3 double - has two points.
i want to describe Z{1} - green, Z{2}- blue,Z{3}-red.
Thanks.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 26 日
z={{rand(1,3)},[{rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)}],[{rand(1,3)} {rand(1,3)} ] }
cl='gbr'
for k=1:numel(z)
y=cell2mat(z{k}')
scatter3(y(:,1),y(:,2),y(:,3),'facecolr',cl(k))
hold on
end
hold off
  7 件のコメント
Tomas
Tomas 2014 年 1 月 26 日
i want universal script, so that I could draw centroid in graf,
for example i have once, matrix T=[ 1 4 6; 7 8 9], once T=[ 1 7 8; 1 2 3; 7 8 9]
matrix T is centroid,[ 1 4 6]is coordinates of the centroid
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 26 日
This is not clear for me, maybe you should post a new question

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 1 月 26 日
pts = cell2mat(vertcat(Z{:}));
colors = [repmat(1,length(Z{1}),1); repmat(2,length(Z{2}),1); repmat(3, length(Z{3}), 1)];
pointsize = 12;
scatter3(pts(:,1), pts(:,2), pts(:,3), pointsize, colors);
  1 件のコメント
Tomas
Tomas 2014 年 1 月 26 日
編集済み: Tomas 2014 年 1 月 26 日
Z={{rand(1,3)},[{rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)} {rand(1,3)}],[{rand(1,3)} {rand(1,3)} ] }
pts = cell2mat(vertcat(Z{:})); colors = [repmat(1,length(Z{1}),1); repmat(2,length(Z{2}),1); repmat(3, length(Z{3}), 1)]; pointsize = 12; scatter3(pts(:,1), pts(:,2), pts(:,3), pointsize, colors);
??? Error using ==> vertcat CAT arguments dimensions are not consistent.
Error in ==> skuskaplottt at 7 pts = cell2mat(vertcat(Z{:}));

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by