View a 3D matrix

4 ビュー (過去 30 日間)
Shivangi
Shivangi 2018 年 1 月 20 日
編集済み: Stephen23 2018 年 1 月 20 日
I have a matrix A(3*3*3)
A(:,:,1) =
5 7 8
0 1 9
4 3 6
A(:,:,2) =
1 0 4
3 5 6
9 8 7
A(:,:,3) =
5 5 5
5 5 5
5 5 5
I want to see this matrix with different numbers displaying different colour in 3D.(like we use imagesc for 2D). Can anybody tell me which command is there for 3D image

回答 (1 件)

Stephen23
Stephen23 2018 年 1 月 20 日
編集済み: Stephen23 2018 年 1 月 20 日
You could use scatter3:
S = size(A);
[X,Y,Z] = ndgrid(1:S(1),1:S(2),1:S(3));
scatter3(X(:),Y(:),Z(:),321,A(:),'filled')
Use colormap to change the colors.

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by