Names for each point in scatter3, Matlab.

2 ビュー (過去 30 日間)
akshay raj
akshay raj 2015 年 1 月 24 日
回答済み: akshay raj 2015 年 1 月 24 日
I have been trying to name each point in space for scatter3 plot in matlab, and came up with this code.
x = [-30;-50;-40;-60;-60;-60;-30;30;60;60;60;40;50;30];
y = [50;30;30;0;20;-60;-80;-80;-60;20;0;30;30;50];
z = [30;0;40;30;0;0;10;10;0;0;30;40;0;30];
for a = 1:14
location{1} = sprintf('AF3');
location{2} = sprintf('F7');
location{3} = sprintf('F3');
location{4} = sprintf('FC5');
location{5} = sprintf('T7');
location{6} = sprintf('P7');
location{7} = sprintf('O1');
location{8} = sprintf('O2');
location{9} = sprintf('P8');
location{10} = sprintf('T8');
location{11} = sprintf('FC6');
location{12} = sprintf('F4');
location{13} = sprintf('F8');
location{14} = sprintf('AF4');
n = location{k};
s=strread(sprintf(n),...
'%s','delimiter','');
end
scatter3(-x,-y,-z);
text(-(x+.1),-(y-.5),-z,s,...
'color',[1,0,0]);
view(115,18)
but when i plot it i get all the points as F7.
I am new to Matlab, can any one help me with this.
thank you.

採用された回答

akshay raj
akshay raj 2015 年 1 月 24 日
I got the answer
x = [-30;-50;-40;-60;-60;-60;-30;30;60;60;60;40;50;30];
y = [50;30;30;0;20;-60;-80;-80;-60;20;0;30;30;50];
z = [30;0;40;30;0;0;10;10;0;0;30;40;0;30];
for a = 1:14
n = location{a};
location{1} = sprintf('AF3');
location{2} = sprintf('F7');
location{3} = sprintf('F3');
location{4} = sprintf('FC5');
location{5} = sprintf('T7');
location{6} = sprintf('P7');
location{7} = sprintf('O1');
location{8} = sprintf('O2');
location{9} = sprintf('P8');
location{10} = sprintf('T8');
location{11} = sprintf('FC6');
location{12} = sprintf('F4');
location{13} = sprintf('F8');
location{14} = sprintf('AF4');
s(a)=strread(sprintf(n),'%s','delimiter','');
end
% end
% the plot
scatter3(-x,-y,-z); % <- NOT <plot3>
text(-(x+.1),-(y-.5),-z,s,...
'color',[1,0,0]);
view(115,18)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by