From 48c490b71eadf20187c93c1541dda3e40843dcce Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 14 Apr 2011 10:01:51 -0400 Subject: functions from abcd.m now in separate files Ignore-this: 33d046a6087834ae6c896966261af8e3 darcs-hash:20110414140151-067c0-7ee6687ce86608989ad7b9b2b1db276c7c11dbc2 --- arrange_optics_along_x.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 arrange_optics_along_x.m (limited to 'arrange_optics_along_x.m') diff --git a/arrange_optics_along_x.m b/arrange_optics_along_x.m new file mode 100644 index 0000000..62db960 --- /dev/null +++ b/arrange_optics_along_x.m @@ -0,0 +1,19 @@ +function optics = arrange_optics_along_x(optics_unsorted) +% arrange optics in proper order so its x position increases with consequent index + N=length(optics_unsorted); + + % assign x positions + x=zeros(1,N); + for i=1:N + x(i)=optics_unsorted{i}.x; + end + + [xs,indx]=sort(x); + cntr=1; + for i=indx + optics{cntr}=optics_unsorted{i}; + cntr=cntr+1; + end +end + + -- cgit v1.2.3