[Scilab-users] hdf5 format and

classic Classic list List threaded Threaded
1 message Options
paul.carrico paul.carrico
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] hdf5 format and

Hi

In the following example, I'm digging into the Scilab help pages in order to understand how I can use hdf5 format; nevertheless I'm still wondering how I can have access to the sub-structure (sub-groups and datasets on them) ?

(I'm thinking in programming recursive search ...)

Thanks

Paul

#######

mode(0)

PATH = get_absolute_file_path("test_hdf5.sce");

// the new file is created
a = h5open(PATH + "/tests.h5", "w");

// a basic group is created
group_name = "MyGroup";
h5group(a, group_name);

// sub-groups creation (using a loop)
for i = 1 : 10
    s = group_name + "/sub_group" + string(i);
    h5group(a,s)
end

// specific groups & sub-groups
h5group(a, "FEM");
h5group(a, "FEM/NODES");
h5group(a, "FEM/ELEMENTS");

// dataset creation using a data matrix
n = 1E3;
i = (1:n)';
A = rand(n,3);
Nodes = zeros(n,4);
Nodes(:,1) = i;
Nodes(:,2:4) = A;
h5write(a,"NODES",Nodes'); // dataset name is NODES here - do not confuse with the sub-group
h5write(a,"FEM/NODES2",Nodes'); // dataset name is NODE2 in FEM group
h5write(a,"FEM/NODES/new_nodes",Nodes'); // add of a new dataset names "new_nodes" in the subgroup NODES in FEM

// tests on the contect of the file (see H objects)
// it's expected to find sub-groups and dataset into them
a.root // list of the groups / datasets and so on at the root
a.root.datasets // specifically list of the datasets

a.root.NODES // provides information's of the "NODES" dataset
a("/FEM")
a("/FEM").datasets
a("/FEM/NODES").datasets
//pause h5close(a);

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users