Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a Built-In Mathematica Function to extract a Sub matrix from a huge external file?

Functions getting pieces of internal nested Lists, (arrays) are in place.


a = {{a1, a2, a3, a4},{b1, b2, b3, b4},{c1, c2, c3, c4}}

Part[a[[1;;2, 3;;4]]]

Give the partial section

{{a3, a4}, {b3, b4}}

Now one example external .csv text file:

a1, a2, a3, a4

b1, b2, b3, b4

c1, c2, c3, c4

The function Import["file",{1;;2, 3;;4} should read in

a3, a4

b3, b4

The external file is just a very large huge two dimensional Array of csv values.

share|improve this question
Welcome to Mathematica.SE. This site is run by Mathematica enthusiasts not Wolfram Research, therefore feature requests are out of place. Perhaps you would like to rephrase your question in light of this. Also, I think that a "user built function" is more practical than you may fear, though perhaps not with optimal performance. – Mr.Wizard Dec 4 '12 at 10:00
If you produce the big file with Mathematica this will do what you ask. – b.gatessucks Dec 4 '12 at 10:04
The framework pointed to by @b.gatessucks will currently only extract some specific row of the matrix, which might be slightly inefficient (although, it is done lazily and the row is then cached in memory until released, so for many elements of the same row it will be ok). I plan to improve on that in the future though. Have a look also at this question and answers therein. – Leonid Shifrin Dec 4 '12 at 12:09
You can also combined those 2 answers, using the recipes from answers to this question to convert the file in question from plain binary (or whatever it is) format to the file-backed key-value store format used by the large data framework. Then, you can work with the framework. Actually, I should extend the framework to perform also this conversion operations. – Leonid Shifrin Dec 4 '12 at 12:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.