I need help diagnosing this. I have a function that was working when I had 5 output arguments and then I added an output argument and saved it and it no longer works. When I run nargout I get 5 when I clearly have 6. Not sure what is going on here. Please help. code below.
function [RMS_before_YPR,RMS_after_YPR,YPR,totalRMS_before,totalRMS_after,visor_corrected] = visor_comp(visor1,visor2);%%Save original data, sort and match data
% orig1=visor1;
% orig2=visor2;
[visor1,visor2] = organize_data(visor1,visor2); %%Create and apply geometric transformation (YPR) to visor1
if isempty(visor1)% [RMS_before_YPR,RMS_after_YPR,YPR,totalRMS]
RMS_before_YPR=0; RMS_after_YPR=0; YPR=0; totalRMS_before=0; totalRMS_after=0;else num=length(visor1); tform=fitgeotrans(visor1,visor2,'nonreflectivesimilarity'); rot_cos=tform.T(1,1); rot_sin=tform.T(2,1); roll=atan2d(rot_sin,rot_cos); yaw=tform.T(3,1); pitch=tform.T(3,2); visor_corrected=transformPointsForward(tform,visor1); RMS_before_YPR = (sqrt(sum((visor2-visor1).^2)./num).*pi./180).*1e3; sum_of_sqs1=sum((visor2(:,1)-visor1(:,1)).^2+(visor2(:,2)-visor1(:,2)).^2)./num; totalRMS_before=(sqrt(sum_of_sqs1).*(pi/180)).*1e3; RMS_after_YPR = (sqrt(sum((visor2-visor_corrected).^2)./num).*pi./180).*1e3; sum_of_sqs2=sum((visor2(:,1)-visor_corrected(:,1)).^2+(visor2(:,2)-visor_corrected(:,2)).^2)./num; totalRMS_after=(sqrt(sum_of_sqs2).*(pi/180)).*1e3; YPR=[yaw,pitch,roll];end
Best Answer