0
$\begingroup$

I have a list of data in which each element has its name as follows:

Inputparameters3 = \!\(\*
TagBox[
RowBox[{"(", "", GridBox[{
{
RowBox[{"\"\<ME4\>\"", "->", "401"}], 
RowBox[{"\"\<MtE4\>\"", "->", "344"}]},
{
RowBox[{"\"\<ME4\>\"", "->", "274"}], 
RowBox[{"\"\<MtE4\>\"", "->", "369"}]},
{
RowBox[{"\"\<ME4\>\"", "->", "314"}], 
RowBox[{"\"\<MtE4\>\"", "->", "268"}]}
},
GridBoxAlignment->{
       "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, 
        "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.7]}, 
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]}, 
Offset[0.2]}, "RowsIndexed" -> {}}], "", ")"}],
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\)

enter image description here

I exported the data by a format of data and imported it by a format of table as follows:

enter image description here

After importing the data, it does not work when I use a replacement rule to call a parameter from the data as follows:

enter image description here

It looks like the problem which I can not call the parameters arises from the commas in the attached image file, but I am not sure how to solve this problem. Would you anyone hint at this problem?

$\endgroup$

1 Answer 1

3
$\begingroup$

You constructed a visual form that gets interpreted as the following, and that is what will be stored:

{{"ME4" -> 401, "MtE4" -> 344}, {"ME4" -> 274, "MtE4" -> 369}, {"ME4" -> 314, "MtE4" -> 268}}

Assume now that the above is stored in Inputparameters3. If you want to store the definition of Inputparameters3for later use, DumpSave makes it easy. It stores all the definitions necessary to reconstruct a symbol. E.g.

Inputparameters3 = {{"ME4" -> 401, "MtE4" -> 344}, {"ME4" -> 274, "MtE4" -> 369}, {"ME4" -> 314, "MtE4" -> 268}};
DumpSave["d:/tmp/test.dat", Inputparameters3];

We may now remove Inputparameters3 or start a new session:

Delete[Inputparameters3]
Inputparameters3

(* Inputparameters3 *)

, but as soon as way call Get(or << for short):

Get["d:/tmp/test.dat"]
Inputparameters3

(* {{"ME4" -> 401, "MtE4" -> 344}, {"ME4" -> 274, 
  "MtE4" -> 369}, {"ME4" -> 314, "MtE4" -> 268}} *)

Inputparameters3 is fully reconstructed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.