0

I have the following code:

ff={"a","b"}
Do[
    mm[ff[[i]]]=RandomReal[];
,{i,Length@ff}]
Do[
    DumpSave["D:\\"<>ToString@ff[[i]]<>".mx",mm[ff[[i]] ]];
,{i,Length@ff}]

This gives

DumpSave::bsnosym: mm[ff[[i]]] is not defined as a symbol or a context.

So obviously the mm[ ff[[i]] ] is not replace as needed when i is set to 1,2,... . The goal is to dump e.g. mm["a"] in a file called a.mx. And this with all the item in the list ff. Is there a way to get this done?

Eisbär
  • 1,476
  • 7
  • 14
  • DumpSave is HoldRest so see 7756 but are you aware that DumpSave["test", mm["a"]] won't work anyway? – Kuba Aug 16 '17 at 11:02
  • 1
    The second argument of DumpSave must be a symbol with assigned definitions. It is these definitions that will be written into a file. DumpDave cannot export pure data without assigning it to a variable first. If you just want to store data, use Export (to MX format) and not DumpSave. – Szabolcs Aug 16 '17 at 13:18
  • 1
    I see I have to re-think my strategy here. I did not new that Export to MX also works. – Eisbär Aug 16 '17 at 14:44
  • The accepted answer in the linked topic will not work since you want to work with parts but the whole topic gives a good overview of available methods. – Kuba Nov 15 '18 at 09:11

0 Answers0