Re: [julia-users] How to save an object of a defined type

2016-10-24 Thread Michele Zaffalon
Can you post a bit more of the code? From the error message, it looks like
you are trying to open an already opened file...

On Sat, Oct 22, 2016 at 7:42 PM,  wrote:

> I have a module defined as module *Core* within which I have defined
> several types (*Node*, *Edge*, *Res*). Now what I intend to do is that I
> want to save the output of a function which is an object (*res1*) of type
> *Res* onto a JLD file so that I can retrieve it later on. I am calling
> the function iteratively and hence at each iteration, I would like to store
> the object in the JLD file. I'm not sure how the syntax of this snippet is
> but here is my attempt at it
>
> using HDF5, JLD
>>> z = jldopen("sample.jld", "w")
>>> write(z, "res1", res1)
>>>
>>>
>>>
> Can you please correct my code? I tried the code on the terminal but I get
> an error for the very first line saying
>
> HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 140049981197376:
>   #000: ../../../src/H5F.c line 1504 in H5Fcreate(): unable to create file
> major: File accessibilty
> minor: Unable to open file
>   #001: ../../../src/H5F.c line 1307 in H5F_open(): unable to truncate a
> file which is already open
> major: File accessibilty
> minor: Unable to open file
>
>
>


[julia-users] How to save an object of a defined type

2016-10-22 Thread varun7rs
I have a module defined as module *Core* within which I have defined 
several types (*Node*, *Edge*, *Res*). Now what I intend to do is that I 
want to save the output of a function which is an object (*res1*) of type 
*Res* onto a JLD file so that I can retrieve it later on. I am calling the 
function iteratively and hence at each iteration, I would like to store the 
object in the JLD file. I'm not sure how the syntax of this snippet is but 
here is my attempt at it

using HDF5, JLD
>> z = jldopen("sample.jld", "w")
>> write(z, "res1", res1)
>>
>>
>>
Can you please correct my code? I tried the code on the terminal but I get 
an error for the very first line saying 

HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 140049981197376:
  #000: ../../../src/H5F.c line 1504 in H5Fcreate(): unable to create file
major: File accessibilty
minor: Unable to open file
  #001: ../../../src/H5F.c line 1307 in H5F_open(): unable to truncate a 
file which is already open
major: File accessibilty
minor: Unable to open file