Student Support Forum: 'Matrix Extract - ignore indices out of bounds' topicStudent Support Forum > General > Archives > "Matrix Extract - ignore indices out of bounds"

 < Previous Comment Help | Reply To Comment | Reply To Topic
 Author Comment/Response yehuda 01/28/13 07:42am 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 URL: ,

 Subject (listing for 'Matrix Extract - ignore indices out of bounds') Author Date Posted Matrix Extract - ignore indices out of bounds Rob 01/25/13 3:47pm Re: Matrix Extract - ignore indices out of bounds yehuda 01/28/13 07:42am
 < Previous Comment Help | Reply To Comment | Reply To Topic