A very simple, and perhaps obvious, question: How can I abort execution of a Matlab M-script using a statement within the script?
This is analogous to calling ret
Yes you can with the help of
return;
Return works in Matlab-scripts like it does in functions.
e.g.
function [ point ] = PointDoubling( x,y,p,a )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
if y==0
point='Not calculated';
return;
end
a2=(3*(x^2))+a;
b2=(2*y);
i=1;
while 1
if mod(b2*i,p)==1
break;
end
i=i+1;
end
s=mod(a2*i,p);
x1=mod(((s^2)-(2*x)),p);
y1=mod(((-y)+(s*(x-x1))),p);
point=[x1,y1];
end