Simple way to delete a matrix column in Mathematica

前端 未结 1 1471
刺人心
刺人心 2021-01-12 07:31

I am trying to delete both a matrix in mathematica. An inelegant way of doing it is as I do below, i.e specifying it in a new matrix as

S = Table[
    Ss[[         


        
相关标签:
1条回答
  • 2021-01-12 07:57

    I think you are looking for:

    Drop[Ss,{t},{t}]  
    

    Timings:

    ClearAll["Global`*"];
    
    First@Timing[a = RandomInteger[1000, {5000, 5000}];]
    0.34
    
    First@Timing[Drop[a, {2}, {2}]]
    0.11
    

    While

    First@Timing[Transpose@Delete[Transpose@Delete[a, 2], 2]]
    0.5
    
    0 讨论(0)
提交回复
热议问题