Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.55 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to remove the Null symbol in a Table in Mathematica?
  2. Table[If[i < 3, i, ## &[]], {i, 5}]
  3.        
  4. {1, 2, ## &[], 3, 4}
  5.        
  6. ----> {1, 2, 3, 4}
  7.        
  8. DeleteCases[list, Null]
  9.        
  10. list /. Null -> Sequence[]
  11.        
  12. list = Table[If[i < 3, i], {i, 5}]
  13.        
  14. list = Select[Table[i, {i, 5}], # < 3 &]
  15.        
  16. Reap@Do[If[i < 3, Sow[i]], {i, 5}]
  17. list = %[[2, 1]]
  18.        
  19. In[12]:= tableGenAltMD[i,{i,5},#<3&]
  20. Out[12]= {1,2}
  21.        
  22. Table[If[i < 3, i, Hold[Sequence[]]] // ReleaseHold, {i, 5}]
  23.        
  24. Unprotect[If];
  25. SetAttributes[If, SequenceHold];
  26.        
  27. Table[If[i < 3, i, Sequence[]], {i, 5}]