data=RandomReal[{-5,7},100]; group=Partition[{-5,-4,-1,2,4,6,7},2,1]; myInterval[mynum_]:=Position[IntervalMemberQ[Interval[#],mynum]&/@group,True][[1,1]]; Gather[Sort@data,myInterval[#1]==myInterval[#2]&] GatherBy[Sort@data,myInterval[#]&]
Copyright 2009 Engadget's Style - Design by FUNction, Ray Wei - Powered by Blogger
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~