New problem I have no errors when runnign my code, but it seems as if the code gives the correct values for the first two runs. I know this because I have compared outputs with the previous code I had with no "loop" in it. My code is below, please take a look and see if you can see where I need a change.
Thanks a lot. %****************FIRST SCAN**************** L=128
f100='C:\MATLAB701\work\Points_CloudsL1'; for idx =1 : 10 if idx==1 %load the spreadsheet flin='C:\Documents and Settings\prhill\My Documents\Hill\Point_Clouds\20_1_00.asc';
flout=[f100,num2str(101)]; else
flin=flout
flout=[f100,num2str(100+idx)]; end
points=load(flin); **CALCULATIONS MADE HERE NOT CURRENTLY SHOWN** for n=1 : size(plane2point,1); if abs(plane2point(n))<L
cull1(m, =[x(n) y(n) z(n)];
m=m+1; end end L=L/2 %Save Point Cloud to File fid_out=fopen(flout,'w')
fprintf(fid_out,'%6.3f %6.3f %6.3f\n',cull1');
fclose(fid_out) %Save A B C values from final plane equation fid=fopen('C:\MATLAB701\work\Vector_ABC_Values_Plane1L','w')
fprintf(fid,'%3.100f %3.100f %3.100f',[A B C]');
fclose(fid) end %plot some points plot3(cull1(:,1),cull1(:,2),cull1(:,3),'.b','MarkerSize',15);
hold on plot3(p_cnrs(:,1), p_cnrs(:,2), p_cnrs(:,3),'m');
plot3(X,Y,Z,'.g','MarkerSize',15); %****************SECOND SCAN**************** LI=128
f200='C:\MATLAB701\work\Points_CloudsL2'; for idxI =1 : 10 if idxI==1 %load the spreadsheet flinI='C:\Documents and Settings\prhill\My Documents\Hill\Point_Clouds\20_2_.02.asc';
floutI=[f200,num2str(201)]; else flinI=floutI
floutI=[f200,num2str(200+idxI)]; end
pointsI=load(flinI); **CALCULATIONS MADE HERE NOT CURRENTLY SHOWN** for nI=1 : size(plane2pointI,1); if abs(plane2pointI(nI))<LI
cull1I(mI, =[xI(nI) yI(nI) zI(nI)];
mI=mI+1; end end LI=LI/2 %Save Point Cloud to File fid_outI=fopen(floutI,'w')
fprintf(fid_outI,'%6.3f %6.3f %6.3f\n',cull1I');
fclose(fid_outI) %Save A B C values from final plane equation fidI=fopen('C:\MATLAB701\work\Vector_ABC_Values_Plane2L','w')
fprintf(fidI,'%3.100f %3.100f %3.100f',[AI BI CI]');
fclose(fidI) end %plot some points plot3(cull1I(:,1),cull1I(:,2),cull1I(:,3),'.r','MarkerSize',15);
hold on plot3(p_cnrsI(:,1), p_cnrsI(:,2), p_cnrsI(:,3),'m');
plot3(XI,YI,ZI,'.g','MarkerSize',15); %**********Solving for angle between two planes***********
%Load A,B,C Values for both Planes val_1=load('C:\MATLAB701\work\Vector_ABC_Values_Plane1L');
A1=val_1(:,1);
B1=val_1(:,2);
C1=val_1(:,3);
val_2=load('C:\MATLAB701\work\Vector_ABC_Values_Plane2L');
A2=val_2(:,1);
B2=val_2(:,2);
C2=val_2(:,3); %Determine Magnitude of Vectors magV1=sqrt(A1^2+B1^2+C1^2);
magV2=sqrt(A2^2+B2^2+C2^2);
M=magV1*magV2; %Create Vectors V1=[A1 B1 C1];
V2=[A2 B2 C2]; %Solve for angle Theta Theta=acos((V1*V2')/M)*(180/pi) |