Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "Matrix Extract - ignore indices out of bounds"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:1+1 =

Original Message (ID '289696') By yehuda:
So, why are you so specific about these values? what do you REALLY want to extract out of the matrix? here is some synthetic matrix mat = RandomInteger[10, {2, 5}]; (*now determine its dimensions, and set the number of rows to m, and number of columns to n *) {m, n} = Dimensions[mat] (* now it will extract the first two rows if there are two, or one, if there is only one row *) (* it will extract the columns 3 to 6 if there are such rows, or the maximum available , starting from 3, if there is a 3'rd column, or the last column, if there are less *) mat[[1 ;; Min[2, m], Min[3, n] ;; Min[6, n]]] yehuda