Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Export["test.h5", {{{1, 2}, {2, 3}}, {{10, 11}, {12, 13}}}, {"Datasets", {"m1", "m2"}}]
- r = Import["test.h5", "Rules"]
- Export["test1.h5", r, "Rules"]
- Export::errelem: The Export element Dataset1 contains a malformed data structure and could not be exported to HDF5 format. >>
- Export::noopen: Cannot open C:UsersajasjaDocumentstest1.h5. >>
- Export["test.h5",
- {{{1,2},{2,3}},{{10,11},{12,13}}},
- {"Datasets",{"m1","m2"}},
- {"Attributes"->{
- "m1"->{
- "ScalarValue"->{10.0},
- "ArrayValues"->{1.0,2.0,3.0},
- "Info"->{""This is a text string""}},
- "m2"->{
- "ScalarValue"->{20.0},
- "ArrayValues"->{-1.0,-2.0,-3.0},
- "Info"->{""This is a text string""}}}}]
- In[] := Import["example.h5", "Attributes"]
- Out[] := {{ArrayValues->{1.,2.,3.},Info->{"This is a text string"},ScalarValue->{10.}},{ArrayValues->{-1.,-2.,-3.},Info->{"This is a text string"},ScalarValue->{20.}}}
- In[1]:= Export["test.h5", "path/to/dataset" -> {
- "Data" -> {1, 2, 3, 4},
- "Attributes" -> {
- "DataDescription" -> "SomeIntegers",
- "DataLength" -> 4
- }
- }
- ];
- Import["test.h5", {"Attributes", "path/to/dataset"}]
- Out[2]= <|"DataDescription" -> "SomeIntegers", "DataLength" -> 4|>
- In[3]:= Export["test.h5", {
- "Datasets" ->
- "path/to/dataset" -> {1, 2, 3, 4},
- "Attributes" ->
- "path/to/dataset" -> {
- "DataDescription" -> "SomeIntegers",
- "DataLength" -> 4
- }
- },
- "Rules"
- ];
- Import["test.h5", {"Attributes", "path/to/dataset"}]
- Out[4]= <|"DataDescription" -> "SomeIntegers", "DataLength" -> 4|>
- In[5]:= Export["test.h5",
- "path/to/dataset" -> {
- "NewAttribute" -> <|"x" -> 1, "y" -> "z"|>
- },
- "Attributes",
- OverwriteTarget -> "Append"
- ];
- Import["test.h5", {"Attributes", "path/to/dataset"}]
- Out[6]= <|"DataDescription" -> "SomeIntegers", "DataLength" -> 4,
- "NewAttribute" -> <|"x" -> 1, "y" -> "z"|>|>
- In[7]:= Export["test.h5",
- "path/to/dataset" -> {
- "DataDescription" -> "New description of the data."
- },
- "Attributes",
- OverwriteTarget -> "Append",
- "AppendMode" -> "Overwrite"
- ];
- Import["test.h5", {"Attributes", "path/to/dataset"}]
- Out[8]= <|"DataDescription" -> "New description of the data.", "DataLength" -> 4,
- "NewAttribute" -> <|"x" -> 1, "y" -> "z"|>|>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement