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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

5-Regular Member

## Join vectors using for loop in Mathcad

Hello everyone,

I am quite new at programming in Mathcad.

I am trying to create a matrix using different vectors that are obtained based on a certain condition:

I made an example with vectors N and M. The idea is to reach at the end the matrix "Final".

Is there a way to use a for loop function to define the final matrix taking into account that the number of rows in the vectors N and M can change (but still equal)?

Thank you,

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald II
(To:MC_9370533)

@MC_9370533 wrote:

Hello everyone,

I am quite new at programming in Mathcad.

I am trying to create a matrix using different vectors that are obtained based on a certain condition:

I made an example with vectors N and M. The idea is to reach at the end the matrix "Final".

Is there a way to use a for loop function to define the final matrix taking into account that the number of rows in the vectors N and M can change (but still equal)?

Perhaps something like this?

Stuart

7 REPLIES 7
23-Emerald II
(To:MC_9370533)

@MC_9370533 wrote:

Hello everyone,

I am quite new at programming in Mathcad.

I am trying to create a matrix using different vectors that are obtained based on a certain condition:

I made an example with vectors N and M. The idea is to reach at the end the matrix "Final".

Is there a way to use a for loop function to define the final matrix taking into account that the number of rows in the vectors N and M can change (but still equal)?

Perhaps something like this?

Stuart

1-Newbie
(To:StuartBruff)
5-Regular Member
(To:StuartBruff)

Thank you for your help StuartBruff.

It worked perfectly.

SG_10318843 I checked that thread before, but not entirely clear.

Either way thank you for the reply.

23-Emerald II
(To:MC_9370533)

@MC_9370533 wrote:

Thank you for your help StuartBruff.

It worked perfectly.

No worries.   Here's a programming-free alternative that should work in Mathcad Express.   It replicates the vectors and then applies the check function with vectorization.

Stuart

21-Topaz I
(To:StuartBruff)

Hi,

This should be Express worthy.

23-Emerald III
(To:MC_9370533)

Ignore the spam posting by SG_10318843...

Here's another implementation that is a bit more general. For arbitrary length arrays, and arbitrary value of ORIGIN:

Success!
Luc

5-Regular Member
(To:LucMeekes)

Thank you Luc.

Miguel,

Announcements
Top Tags