blob: 62db960fd905481869b23a3ed227ed7f8572a162 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
|