hello everyone. I would like to ask which part of the code written below is wrong. There are two steps: 1. Add a zero matrix of N rows and 2 columns to a matrix; 2. Remove the zero matrix of N rows and 2 columns from a matrix. Thank you very much.
조회 수: 1 (최근 30일)
이전 댓글 표시
[ma,na] = size(dataC);
[mb,nb] = size(dataD);
if ma>=mb
out1= zeros((ma-mb),2);
dataD1=[dataD;out1];%Add the 0 matrix of rows and 2 columns to one block
dataF=intersect(dataC,dataD1);
dataF(dataF==0)=[];
else
out2= zeros((mb-ma),2);
dataC1=[dataC;out2];%Add the 0 matrix of N rows and 2 columns to one block
dataF=intersect(dataC1,dataD);
dataF(dataF==0)=[];
end
%%%%%%%%%%%%%%%%%%%The coordinate dataG of the same point in datae and dataF%%%%%%%%%%%%%%%%%
[mc,nc] = size(dataE);
[md,nd] = size(dataF);
if mc>=md
out3= zeros((mc-md),2);
dataF1=[dataF;out3];%Add the 0 matrix of N rows and 2 columns to one block
dataG=intersect(dataE,dataF1);
dataG(dataG(1,:)==0)=[];
else
out4= zeros((mc-md),2);
dataE1=[dataE;out4];%Add the 0 matrix of N rows and 2 columns to one block
dataG=intersect(dataE1,dataF);
dataG(dataG(1,:)==0)=[];
end
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!