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

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

How can one choose the last column of a matrix?

MortezaA
1-Visitor

How can one choose the last column of a matrix?

I have a matrix that might change size in every particular run and I need the program to automatically plot the last column versus some other variable.but I cant choose the U<no. of column> command since I don't know how big my matrix is gonna be this time

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:MortezaA)

Use

UCols1.png

or if you changed ORIGIN you should use

Ucols2.png

View solution in original post

5 REPLIES 5
MichaelH
12-Amethyst
(To:MortezaA)

Use the cols() function.

Werner_E
25-Diamond I
(To:MortezaA)

Use

UCols1.png

or if you changed ORIGIN you should use

Ucols2.png

Another approach. Overkill I know but couldn't resist. At least you know have the ability to extract rows from Matricies.

Clipboard01.jpg

Mike

To complete it add an additional transpose at the end.

Overkill? 🙂 Think we have a new example to explain what an euphemism is

The transpose-column extract-transpose way work pretty well, but with large matrices an in side a loop it gets terribly slow. Generally its surprising that the built in matrix routines are much slower than self written routines using for-loops - especially augment and stack. One would expect the opposite. This was discussed and timed in an older thread and really was astonishing.

Werner Exinger wrote:

To complete it add an additional transpose at the end.

Overkill? 🙂 Think we have a new example to explain what an euphemism is

Sorry, was a little lazy of me.

The transpose-column extract-transpose way work pretty well, but with large matrices an in side a loop it gets terribly slow. Generally its surprising that the built in matrix routines are much slower than self written routines using for-loops - especially augment and stack. One would expect the opposite. This was discussed and timed in an older thread and really was astonishing.

I remember that thread and you are correct the results where astonishing.

Mike

Announcements

Top Tags