Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

May be duplicate, but, how it is possible to make a matrix or table of smaller dimensions, from a matrix with bigger dimensions. I mean, one may want to extract a 25*25 table from a 25*50 matrix. I did not understand the solutions mentioned in this page and this one.

share|improve this question

closed as off-topic by Öskå, Sjoerd C. de Vries, belisarius, Michael E2, Yves Klett Jun 17 at 17:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Öskå, Sjoerd C. de Vries, belisarius, Michael E2, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Please check this. Is it what you mean? –  Öskå Jun 17 at 12:44
    
Is the second matrix extracted from the first one? –  Parsa Jun 17 at 12:46
    
Well, if you look at the image you will see that it is, isn't it? –  Öskå Jun 17 at 12:49
    
Yes you are right. But I do not fully understand the codes as I a beginner user. –  Parsa Jun 17 at 12:51
    
Take a look at Part and Span in the documentation. If it helps mat[[All, ;; 2]] is equivalent to mat[[All, 1 ;; 2]]. It means that from mat you will take All the rows but only the columns from 1 to 2; with 1 to 2 translated by 1;;2. –  Öskå Jun 17 at 12:54
add comment

1 Answer 1

It's very easy with Mathematica:

Build a matrix:

m = Partition[Table[i, {i, 1, 100}], 10]

Take first three rows:

m[[1 ;; 3, All]]

Take last three rows:

m[[-3 ;; -1, All]] 

Take columns 3 and 4:

m[[All, 3 ;; 4]] 

Take just something:

m[[4 ;; 5, 6 ;; 7]]
share|improve this answer
    
I did it by means of the syntax bellow but I can not post it as I have not enough reputations: Block[{i=25, j=25}, Take[MatrixA, i, j]] –  Parsa Jun 17 at 14:15
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.