EDIT How to simplify the following code:
if(x(a) > x(b))
s = b;
e = a;
else
s = a;
e = b;
end
I can get it shorter like:
s = a;
e = b;
if(x(a) > x(b))
s = b;
e = a;
end
Thanks!
EDIT
h = [a b];
[~, idx] = min([x(a) x(b)]);
s = h(idx)
e = h(3-idx)
Are you sure your code does what you wanted it to do?
Maybe you want to try
EDIT: OK there you go,
you have what you need in
rbut if you need them assandethen: