Error converting from matlab to python

0

I want to convert the following function into matlab for python:

Função Matlab
cn = reshape(repmat(sn, n_rep, 1), 1,[]);

resultado matlab

cn =

  Columns 1 through 23

     1     1     1     1     1     1     0     0     0     1     1     1     1     1     1     0     0     0     0     0     0     1     1

  Columns 24 through 46

     1     1     1     1     1     1     1     0     0     0     1     1     1     1     1     1     0     0     0     1     1     1     0

  Columns 47 through 69

     0     0     0     0     0     1     1     1     1     1     1     1     1     1     1     1     1     0     0     0     1     1     1

  Columns 70 through 92

     1     1     1     1     1     1     1     1     1     1     1     1     0     0     0     1     1     1     0     0     0     1     1

  Columns 93 through 115

     1     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     1     1     1     0     0     0     1

  Columns 116 through 138

     1     1     0     0     0     0     0     0     0     0     0     1     1     1     1     1     1     0     0     0     0     0     0

  Columns 139 through 161

     0     0     0     1     1     1     1     1     1     1     1     1     0     0     0     1     1     1     1     1     1     0     0

  Columns 162 through 184

     0     0     0     0     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0     1     1     1     0

  Columns 185 through 207

     0     0     1     1     1     1     1     1     1     1     1     1     1     1     1     1     1     0     0     0     0     0     0

  Columns 208 through 230

     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0     0     0

  Columns 231 through 253

     0     0     0     0     1     1     1     0     0     0     0     0     0     1     1     1     1     1     1     1     1     1     1

  Columns 254 through 276

     1     1     0     0     0     1     1     1     1     1     1     0     0     0     1     1     1     0     0     0     0     0     0

  Columns 277 through 299

     1     1     1     1     1     1     1     1     1     0     0     0     1     1     1     0     0     0     0     0     0     0     0

  Columns 300 through 322

     0     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0     1

  Columns 323 through 345

     1     1     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     1     1     1     0     0     0

  Columns 346 through 368

     1     1     1     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     1     1     1     0     0

  Columns 369 through 391

     0     1     1     1     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     1     1     1     0

  Columns 392 through 414

     0     0     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     1     1     1

  Columns 415 through 437

     1     1     1     0     0     0     1     1     1     1     1     1     0     0     0     1     1     1     0     0     0     0     0

  Columns 438 through 460

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     1

  Columns 461 through 483

     1     1     0     0     0     0     0     0     0     0     0     1     1     1     0     0     0     0     0     0     1     1     1

  Columns 484 through 506

     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     1     1     1     1     1

  Columns 507 through 529

     1     0     0     0     0     0     0     0     0     0     1     1     1     0     0     0     0     0     0     0     0     0     1

  Columns 530 through 552

     1     1     1     1     1     1     1     1     0     0     0     1     1     1     0     0     0     1     1     1     0     0     0

  Columns 553 through 575

     1     1     1     0     0     0     0     0     0     1     1     1     1     1     1     0     0     0     1     1     1     1     1

  Columns 576 through 598

     1     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     1     1     1     1     1     1     1

  Columns 599 through 621

     1     1     1     1     1     0     0     0     1     1     1     1     1     1     0     0     0     1     1     1     1     1     1

  Columns 622 through 644

     1     1     1     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0     1     1

  Columns 645 through 667

     1     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     1     1     1     0

  Columns 668 through 690

     0     0     0     0     0     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0

  Columns 691 through 713

     1     1     1     0     0     0     1     1     1     1     1     1     0     0     0     0     0     0     0     0     0     0     0

  Columns 714 through 736

     0     0     0     0     1     1     1     0     0     0     0     0     0     1     1     1     0     0     0     1     1     1     1

  Columns 737 through 759

     1     1     0     0     0     1     1     1     0     0     0     0     0     0     1     1     1     1     1     1     1     1     1

  Columns 760 through 768

     0     0     0     0     0     0     1     1     1

In python I thus have the converted function

cn=np.arange(sn,n_rep).reshape(1)

result

cn=np.arange(sn,n_rep).reshape(1)

TypeError: only length-1 arrays can be converted to Python scalars

How can I perform the same as matlab, what do I have to change?

    
asked by anonymous 06.10.2017 / 15:24

0 answers