Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • adding 100 rows in a matrix from different 100 matrices

    Hello,
    I am trying to make a column matrix (100X1) using different 100 matrices? What is the best possible way to do it?

    If I write individually for each row, it will be like:
    mat A = b1\b2\b3\b4 ........ so on till b100
    Is there any way to make it simpler to write?

    Thanks in advance

  • #2
    Something like this might work for you
    Code:
    matrix A=J(100,1,.)
    forval j=1(1)100 {
     matrix A[`j',1]=b`j'
    }
    matrix list A

    Comment


    • #3
      John may well be right here, but I'm not sure of what your problem is because you did not tell us anything about the dimensions of your "100 different matrices." You presumably know that, but we can only guess.

      Comment


      • #4
        Mike raises a good point. I took it from the scenario as described in #1 that each of the bj matrixes was 1x1. Probably a better and more general solution (assuming that all the bj matrixes have the same column dimension) is
        Code:
        matrix A=b1
        forval j=2(1)100 {
         matrix A=A\b`j'
        }
        matrix list A

        Comment


        • #5
          Yes. It's 1x1.
          Thanks it worked.

          Comment

          Working...
          X