Advertisement
Guest User

Untitled

a guest
Aug 9th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. CellsByTag[notebook_, tag_] := Module[{cells},
  2. cells[nb_NotebookObject] := cells[nb, _];
  3. cells[nb_NotebookObject, pat_] :=
  4. Flatten@cells[First@NotebookGet[nb], pat];
  5. cells[cellList_List, pat_] := cells[#, pat] & /@ cellList;
  6. cells[Cell[CellGroupData[group_List, ___]], pat_] :=
  7. cells[#, pat] & /@ group;
  8. cells[c_Cell, pat_] := If[MatchQ[c, pat], c, {}];
  9. cells[__] := {};
  10. cells[notebook, _?(MemberQ[Flatten[{CellTags} /. Options[#]],
  11. tag] &)]
  12. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement