Consider an mx file to which has been saved the following data

{(*list of hundred coords*)}

via Export[name.mx,lst]. The heads are


Assume that "postions" i.e. {(*list of hundred coords*) takes a lot of time to load if one uses a direct Import on the entire list.

I wish to be able to

  1. Load just the "schema" of the file i.e. just {"schema,ver,N,positions"} or just upto "N" i.e. {{"schema,ver,N,positions"},1,100}. In other words, how to selectively read particular values without loading the entire list itself? For simplification say we are only interested in reading the top level values in the list.

  2. Correct the list without loading the entire list. Say I want to correct the file as following

  • Change type: {"schema,ver,N,positions"} $\to$"schema,ver,N,positions"
  • Add new entries e.g. add "length_Integer" b/w "ver" and "N".
  • change existing entries: say an entry in "positions" was corrupted, so modify that position.
  • change existing entries(if sub-list edits aren't possible): say change "ver" to 2

I haven't used streams before so please highlight any pitfalls, better approaches, "do something else instead" advice. Thank you.


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.