You can also work directly with the HDF5 file as an array object...

using HDF5

hfi=h5open("myfile.h5","w"); # create the file
close(hfi)

 A = reshape(1: 120, 15, 8);

hfi = h5open("myfile.h5","r+") # read/write access

hfi["mygroup/A"] = A
15x8 Array{Int64,2}:
  1  16  31  46  61  76   91  106
...
 14  29  44  59  74  89  104  119
 15  30  45  60  75  90  105  120

data = hfi["mygroup/A"][2:3:15,3:5]
5x3 Array{Int64,2}:
 32  47  62
 35  50  65
 38  53  68
 41  56  71
 44  59  74

 hfi["mygroup/A"][2:3,3:5]
2x3 Array{Int64,2}:
 32  47  62
 33  48  63

hfi["mygroup/A"][2:3,3:5]=[-1 -2 -3; -4 -5 -6]
2x3 Array{Int64,2}:
 -1  -2  -3
 -4  -5  -6

hfi["mygroup/A"][1:5,:]
5x8 Array{Int64,2}:
 1  16  31  46  61  76  91  106
 2  17  -1  -2  -3  77  92  107
 3  18  -4  -5  -6  78  93  108
 4  19  34  49  64  79  94  109
 5  20  35  50  65  80  95  110

foo = hfi["mygroup/A"]
HDF5 dataset: /mygroup/A (file: myfile.h5)

foo[1:5,:]
5x8 Array{Int64,2}:
 1  16  31  46  61  76  91  106
 2  17  -1  -2  -3  77  92  107
 3  18  -4  -5  -6  78  93  108
 4  19  34  49  64  79  94  109
 5  20  35  50  65  80  95  110

close(hfi)

HDF5 is awesome!




On Sun, Jan 4, 2015 at 4:59 PM, paul analyst <[email protected]> wrote:

> Of course, first I read :)
> Is there about reading range array. I need to save a range of In analogy
> to.
>
> A = reshape (1: 120, 15, 8)
> h5write ("/ tmp / test2.h5", "mygroup2 / A", A)
> data = h5read ("/ tmp / test2.h5", "mygroup2 / A" (2: 3: 15: 3: 5))
>
> Paul
>
>
> W dniu niedziela, 4 stycznia 2015 14:14:03 UTC+1 użytkownik Tim Holy
> napisał:
>>
>> If I understand correctly, then yes, that's possible. See the HDF5 docs.
>>
>> --Tim
>>
>> On Sunday, January 04, 2015 04:25:13 AM paul analyst wrote:
>> > How to overwrite to an existing file, only range of data?
>> > In HDF5 can do this?
>> > I have an array of zeros 10 x 10
>> > I need an existing file owerwrite range rand (5x5), for example.
>> > Existingfile [2: 7.3: 8]
>> > Paul
>>
>>

Reply via email to