Assigning a 3D scatter plot to structure array

조회 수: 9 (최근 30일)
Tom
Tom 2014년 2월 17일
편집: per isakson 2014년 2월 18일
Hello,
Is it possible to assign scatter plots in a structure array which can then be recalled individually?
I currently have the following line:
cell_data(i).visual = scatter3(a(:,1), a(:,2), a(:,3),50, 'fill')
However if I try to recall any individual plot I just receive a number...
Kind regards,
Tom
  댓글 수: 3
Tom
Tom 2014년 2월 17일
In the structure array there is an associated matrix where the first column is x positions, second column y, and third column z.:
cell_data(i).positions
0.5288 0.2819 1.4861
-0.3424 1.4281 -0.7547
1.3766 -0.5107 -0.7808
-1.1564 -1.0787 -0.0540
It'd be useful if I could call up the 3D scatter plot for each entry in the structure array, is this possible?
per isakson
per isakson 2014년 2월 18일
편집: per isakson 2014년 2월 18일
You assign values to cell_data(i).positions in your code? Is it the values of a?
"call up the 3D scatter plot". Do you mean make the plot visible; bring it to the top?

댓글을 달려면 로그인하십시오.

답변 (1개)

per isakson
per isakson 2014년 2월 18일
Try this with the [Run and Advance] button
jj = 1;
a = magic( 3 );
figure
cell_data(jj).visual = scatter3(a(:,1), a(:,2), a(:,3), 50, 'fill');
jj = 2;
a = randi( 6, [3,3] );
figure % create new figure; avoid overwriting
cell_data(jj).visual = scatter3(a(:,1), a(:,2), a(:,3), 50, 'fill');
get( cell_data(jj).visual, 'Type' )
fh = ancestor( cell_data(jj).visual, 'figure' );
figure( fh )

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by