필터 지우기
필터 지우기

Connecting line

조회 수: 1 (최근 30일)
Chaklader Asfak
Chaklader Asfak 2011년 8월 19일
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 ?

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 8월 19일
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
Chaklader Asfak
Chaklader Asfak 2011년 8월 19일
Thanks. I can understand the reshape one but could you please explain about the arrayfun function ? What is i1 here ?
Andrei Bobrov
Andrei Bobrov 2011년 8월 19일
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

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by