cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

6-Contributor

## combining two matrices column by column

I have two matrices in Mathcad 15 with the same number of rows each and the same number of columns each. The number of rows and columns are not fixed.

I want to obtain a combined matrix, as indicated below, where C1, C2, C3 are columns:

MatrixA_C1    MatrixB_C1    MatrixA_C2    MatrixB_C2    MatrixA_C3    MatrixB_C3    ...

See attached example in Mathcad 15.

Thank you,

Otilia

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:Otilia)

Here are two functions to achieve the desired result.

The two matrices must have the same dimensions (same number of columns and rows) - there is no error check built in.

4 REPLIES 4
23-Emerald I
(To:Otilia)

You can address each column of each matrix, A<0> means the zeroth(first) column of matrix A.

After that you can use the augment command:

result := augment(A<0>, B<0>, A<1>, B<1>,   )

For any single case you could write it out, for general use you could program it.

24-Ruby V
(To:Otilia)

Here are two functions to achieve the desired result.

The two matrices must have the same dimensions (same number of columns and rows) - there is no error check built in.

17-Peridot
(To:Otilia)

Here's another option:

Alan

6-Contributor
(To:Otilia)

Thank you, the two solutions that consider x number of rows and  y number of columns work perfectly with my case, but  I can use the function for multiple variables which i have in the same calculation file (density, enthalpy, entropy).

Otilia

Announcements
Top Tags