3

Having this code:

imagesData = 
  Module[{names = 
    Table[
      StringJoin[
        "D:\stuff\img_",
        ToString[n /. n -> If[nn <= 9, "0" <> ToString@nn, nn]],
        ".jpg"], 
      {nn, 0, 43, 1}]}, 
   Table[Import[names[[n]], "Data"], {n, 1, 44, 1}]];

I want to import some images. I don't want to import them every single time because it takes some time. Is it possible to assign the imagesData value (list of list of list I guess) to another variable so I dont have to import it every single time I open my notebook?

What I tried was to print it on screen, copy and paste the printed values so I can assign them to another variable. This methods is not an option, I guess, because the output generation time is so long. Is it possible to get what is in the variable without printing it on screen, so I will be able to assign its numerical value into another variable and therefore get rid of import time-consuming part?

m0nhawk
  • 3,867
  • 1
  • 20
  • 35
michelson
  • 443
  • 2
  • 7
  • 3
    first of all, have you tried Export["imagesData.zip",{"imagesData.mx"->imagesData}] which is the fastest and most compact way to reload MMA data from session to session. You bring it back in with Import["imagesData.zip","imagesData.mx"] – Manuel --Moe-- G Mar 09 '16 at 19:29
  • 7
    Related: http://mathematica.stackexchange.com/questions/11891/attaching-a-file-to-a-notebook and http://mathematica.stackexchange.com/q/79561/131 – Yves Klett Mar 09 '16 at 19:29
  • @Manuel--Moe--G No I haven't, however solutions provided by Yves Klett seems suitable for this task. Out of curiosity I will test your solution as well. Thanks for quick and precise answer! – michelson Mar 09 '16 at 19:45
  • 1
    Try using LocalSymbol http://mathematica.stackexchange.com/questions/97498/making-large-calculation-results-persistent – Basheer Algohi Mar 09 '16 at 19:57

0 Answers0