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

SOLVED
Highlighted
Newbie

## Build New Matrix by Selecting Specific Columns of Another Matrix

Also, if "A" matrix is n rows, "B" matrix will always be n x n.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Member
(in response to hriek)

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

Here's one way ...

8 REPLIES 8
Highlighted
Regular Member
(in response to hriek)

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

Here's one way ...

Highlighted

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

Thank you StuartBruff.

However the following won't work for me, but it's not like I need it anyway.

I get the error "this value must be an integer" for 'k'

Highlighted

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

Get rid of the in-line evaluation of k and it should work.

By using the in-line evaluation, you are unknowingly converting k from a range variable to an array.

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

Thank you

Highlighted
Regular Member
(in response to hriek)

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

 Hunter Riek wrote: Thank you StuartBruff. However the following won't work for me, but it's not like I need it anyway. I get the error "this value must be an integer" for 'k'

Unfortunately, it's difficult to know why you're getting  this problem from just looking at screen shot; there are a number of little "Mathcadisms" that can make different expressions look visually similar (eg, array indices and name subscripts ... these are a common trap for novices and the forgetful!).  In addition, it may be that something else above the region of interest is affecting the results (or even a global definition that occurs after the region!).  Or even something in a region that is (partially) hidden by another region.

I'm guessing that that source of the problem is the evaluation operator (=) that you've got after the range variable k definition.  This has the side-effect of converting the range into a vector.  As you need to use integers as array indices, Mathcad is going to squawk about k being a vector.

Highlighted
Regular Member
(in response to MJG)

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

I see you beat me to it, Mark!

Stuart

Highlighted

## Re: Build New Matrix by Selecting Specific Columns of Another Matrix

I was intrigued with this problem to see if there was a way to accomplish the same thing without a Mathcad program.  It took me awhile, but here it is.

Highlighted

Hi.

Two more ways.

Best regards.

Alvaro.

Announcements