Bottom Page

Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Array to construct matrix
#1
Hi guys,

I have 3 arrays with 10 elements which I used numpy to create:

Array 1    Array 2    Array 3
    1              2             3
    1              2             3
    1              2             3
    1              2             3
    .               .              .
    .               .              .
    .               .              .


I'd like to construct a matrix 3x10 with these arrays used as columns:

|1  2  3|
|1  2  3|
|1  2  3|
|.   .   . |
|.   .   . |
|.   .   . |

In MatLab I can do this with this command: Matrix = [Array1, Array2, Array3].

I tried something similar in Python 3.5.2 but I received the type "List". I appreciate the help.

Hi guys,

I found a solution using "np.column_stack".

In the address below, I found helpful information to those who wants to migrate from MatLab to Python. XD
https://docs.scipy.org/doc/numpy-dev/use...users.html
Quote
#2
Thanks for posting back the solution!
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 368 Apr-09-2019, 04:54 PM
Last Post: PhysChem

Forum Jump:


Users browsing this thread: 1 Guest(s)