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.

  • 2
    $\begingroup$ 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. $\endgroup$ – Mr.Wizard Dec 4 '12 at 10:00
  • $\begingroup$ If you produce the big file with Mathematica this will do what you ask. $\endgroup$ – b.gates.you.know.what Dec 4 '12 at 10:04
  • $\begingroup$ 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. $\endgroup$ – Leonid Shifrin Dec 4 '12 at 12:09
  • $\begingroup$ 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. $\endgroup$ – Leonid Shifrin Dec 4 '12 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.