diff options
author | Matt Argao <mcargao@email.wm.edu> | 2012-11-29 17:20:02 -0500 |
---|---|---|
committer | Matt Argao <mcargao@email.wm.edu> | 2012-11-29 17:20:02 -0500 |
commit | b07d219465e3c2c54390f107ba19f02f6574e403 (patch) | |
tree | 80c2afd7f3a49d052557d8df9cf549caf70d69aa | |
parent | e3ac1a7a63f30b33e8b8e7d6817a835352a1064f (diff) | |
download | mode_match-b07d219465e3c2c54390f107ba19f02f6574e403.tar.gz mode_match-b07d219465e3c2c54390f107ba19f02f6574e403.zip |
Check if optics are already arranged
-rw-r--r-- | arrange_optics_along_x.m | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arrange_optics_along_x.m b/arrange_optics_along_x.m index 62db960..817656a 100644 --- a/arrange_optics_along_x.m +++ b/arrange_optics_along_x.m @@ -6,9 +6,14 @@ function optics = arrange_optics_along_x(optics_unsorted) x=zeros(1,N); for i=1:N x(i)=optics_unsorted{i}.x; - end + end - [xs,indx]=sort(x); + if issorted(x) + optics = optics_unsorted; + return + end + + [xs,indx]=sort(x); cntr=1; for i=indx optics{cntr}=optics_unsorted{i}; |