Hello, I would appreciate your help, I am new to using Matlab and my programming skills are very basic. Could someone explain to me what this piece of code performs:
axd2i=axd2(:,1);axd2d=axd2(:,2);
axd2i(axd2i==0)=[];axd2d(axd2d==0)=[];
axd2=[axd2i axd2d];
z=0;
y=length (axd2(:,1));
for i=y:-1:1
if y-i+1==axd2(i,2)
z=z+1;
end
end
axd2=axd2(y-z+1:end,:);
It is a program to graph arrows in a structure, but the author is sick with COVID and cannot help me at this time.
Thanks in advance

 채택된 답변

KSSV
KSSV 2021년 1월 5일

1 개 추천

axd2i=axd2(:,1); % get the first column of axd2
axd2d=axd2(:,2); % get the second column of axd2
axd2i(axd2i==0)=[]; % remove the elements which are zeros
axd2d(axd2d==0)=[]; % remove the elements which are zeroes
axd2=[axd2i axd2d]; % merge them into a column matrix. (May fail if zeroes are different)
z=0; % initialize z with 0
y=length (axd2(:,1)); % get the number of rows/ elements
for i=y:-1:1
if y-i+1==axd2(i,2)
z=z+1;
end
end
axd2=axd2(y-z+1:end,:);

댓글 수: 1

Cristian Antonio Vega Cueva
Cristian Antonio Vega Cueva 2021년 1월 5일
Thank you very much, you have no idea how much I appreciate the help.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Calendar에 대해 자세히 알아보기

제품

릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by