Skip to main content
8-Gravel
July 13, 2022
Solved

Extracting Rows Based on Array Values

  • July 13, 2022
  • 3 replies
  • 6061 views

I have an array with values and I want to extract the rows, from a different matrix, that correspond to the values of the array. Any ideas on how that is possible? Right now the row extraction command (CRTL+SHIFT+r) will only accept integers.

 

Thank you in advance

Best answer by LucMeekes

To select an integer, klick on it. That is the standard Microsoft answer.

From where would you want to select an integer. You show a number of pictures, with several structures that contain integers.

 

I still think that your task is (the same as what is) explained, and solved, in this thread: https://community.ptc.com/t5/Mathcad/Retrive-horizontal-matrix-rows-based-on-vector-in-Mathcad/m-p/797732#M201303

For you convenience I've translated Stuart's worksheet to Prime6, so you should be able to load it.

Did you look at it? Does it meet your needs? If not, then as Werner already indicated: explain clearly, by a simple example, what you do need.

Preferably attach that simple example as a Prime Worksheet, NOT just a picture.

 

Success!
Luc

3 replies

21-Topaz II
July 13, 2022

Hi,

Can you provide an example for more clarity?

Cheers

Terry

8-Gravel
July 13, 2022

Hi, I have a series of loads from load combinations that are placed on my model. I export those forces into excel and then bring them into MathCAD as an array. Right now, I check by hand, what I think will be the limiting factors, run the calculations for those scenarios and then see what it returns. What I want to do is run all load combination calculations at once and have MathCAD tell me which load combination(s) are the limiting factor(s).

25-Diamond I
July 13, 2022

> I have an array with values and I want to extract the rows, from a different matrix, that correspond to the values of the array. 

Still not clear for me what exactly this should mean.

Maybe you would be better off if you provide one or two specific numerical examples, each showing the matrix, the vector AND the result you would like to see.

23-Emerald IV
July 13, 2022

"Right now the row extraction command (CRTL+SHIFT+r) will only accept integers."

And that is for good reasons. Rows and columns of arrays are numbered sequentially, similar to platforms on a train station. As there is no platform 9¾ on London's Kings Cross station (except of course if you're a wizard), there is no row 3.14 in an array between rows 3 and 4..

 

Is your problem related, or similar, to this: https://community.ptc.com/t5/Mathcad/Retrive-horizontal-matrix-rows-based-on-vector-in-Mathcad/m-p/797732#M201303 ?

 

Luc

23-Emerald IV
July 13, 2022

Decided to try some magic...

LucMeekes_0-1657708431635.png

Success!
Luc

8-Gravel
July 13, 2022

Hi LucMeekes,

 

I have PTC Prime 6.0 so I can't see the file but thank you for your help, much appreciated! I was wondering if you could perhaps explain the function? I am new(er) to MathCAD and was hoping you could guide me through on what you did.

 

If not, I understand but thank you once again.

23-Emerald IV
July 13, 2022

The file was saved from Prime 6, so it should open in Prime 6 without problems. If it doesn't, let me know.

 

The function treats the values in the vector l as a list of row indexes. When an index is an integer number, it will fetch that row from the matrix M. If the index contains a fractional part, it will take the weighted average between two rows, as weighted by the fractional part.

So for 0.5 you get the average of (the values of) row 0 and row 1.

 

Success!
Luc