Effacer les filtres
Effacer les filtres

Connecting line

1 vue (au cours des 30 derniers jours)
Chaklader Asfak
Chaklader Asfak le 19 Août 2011
I have a excel file from where I made plot3. The Excel file is here: http://www.4shared.com/file/Gcoz8xa0/Contour.html and coding of the M-file is :
clear all
[Num,Txt,Raw]=xlsread('Contour.xlsx');
a=Num(:,1);
b=Num(:,2);
c=Num(:,3);
d=Num(:,4);
e=Num(:,5);
f=Num(:,6);
figure(3);
plot3(c,b,a,'-+r',e,f,d,'--og')
grid on
xlim('auto')
ylim('auto')
zlim('auto')
xlabel('X')
ylabel('Y')
zlabel('Z')
I need to connect all the points of the two lines along Z axis (from z= 5 to 20 each points)(Say, for Z=5, [b,c]= (1.1, 24)and [e,f]=(-34,1.5) ) . Any one can help me how to connect these points ?

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 19 Août 2011
added after your code
hold on
k = reshape([3 2 1 5 6 4],3,[]);
arrayfun(@(i1)plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:))),1:size(Num,1))
  2 commentaires
Chaklader Asfak
Chaklader Asfak le 19 Août 2011
Thanks. I can understand the reshape one but could you please explain about the arrayfun function ? What is i1 here ?
Andrei Bobrov
Andrei Bobrov le 19 Août 2011
i1 - variable in anonymous function @(i1)plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:)))
% analog use loop
for i1 = 1:size(Num,1)
plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:)));hold on;
end

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by