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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

submatrix variants ...

StuartBruff
23-Emerald II

submatrix variants ...

Whilst the built-in submatrix is adequate for most of my purposes, I often have cases where I want to either pick elements in a more arbitrary fashion (eg, a list of indices from a filter function) or have non-contiguous blocks (eg, every other column or row). I also occasionally want to reference the indices from the end of a row or column rather then their starts, but don't want to go to the trouble of calculating the adjusted indices.

In addition, I'm quite lazy and don't really see why I should go to all the trouble of typing out zeros for the column indices when all I want is the elements of a vector (I also think it makes it slightly harder for others to intepret).

Consequently, I have written a couple of variants of submatrix that extend its capabilities by allowing end-relative addressing and non-contiguous data, including vector counterparts of each function. The attached M15 worksheet contains the definitions of these functions plus some examples showing their use.

Comments / improvements / alternatives welcome!

Stuart

1 REPLY 1

Thanks a lot! Excellent work as usual. I have to give it a closer look as to where the difference to your great collection of utility routines is, which I downloaded quite some times,

Wish I would be better organized to find all those things when needed.

Top Tags