Concatenating empty array in Numpy

后端 未结 6 496
情歌与酒
情歌与酒 2021-01-30 16:04

in Matlab I do this:

>> E = [];
>> A = [1 2 3 4 5; 10 20 30 40 50];
>> E = [E ; A]

E =

     1     2     3     4     5
    10    20    30    4         


        
6条回答
  •  逝去的感伤
    2021-01-30 16:54

    If you wanna do this just because you cannot concatenate an array with an initialized empty array in a loop, then just use a conditional statement, e.g.

    if (i == 0): 
       do the first assignment
    else:  
       start your contactenate 
    

提交回复
热议问题