octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OOP load update


From: Robert T. Short
Subject: Re: OOP load update
Date: Tue, 05 May 2009 13:06:43 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16

Ahh! I did try save --ascii. My bad. Should have read the docs more carefully. Actually I didn't really test this on any real variety of file formats. Just one more item..... In fact when I said binary, I was being very sloppy. I should have said matfile version 6. I saved v6 mat files in MATLAB and read them here as well as saving them from octave and reading them back. So, Bob needs to do some more testing. I think the structure is pretty solid though. There are some interesting issues that I will bring up when I can spare a few minutes.

It works very well from hdf5 and mat file formats and, yes, the changes will be essentially the same for the save_ascii function. I tested this on many different types of inheritance and aggregation and it works really well. I didn't have to muck about your "exemplar" stuff at all either, so that was well-conceived. Note that if there is an object load failure I don't return the struct, just fail. I will try to figure out something that works. It might be just fine to return the broken object and use the struct(obj) function to get the struct info from the class. Of course, I will have to write the struct(obj) function, but I think that will be pretty easy.

I will fix the save_ascii thing and try to figure out what to do when there is a class structure mismatch. The next thing is to see that "clear classes" works. Since I have to figure out exactly what "works" means, there is some effort involved.

Just some other information.

I went and re-read the MATLAB documentation; it says very clearly that a class constructor must be able to handle the no-argument case since the constructor is called for loading from a mat file and and building arrays of objects. They don't actually test for it of course, and I am quite sure they DON'T call the constructor for loading from a mat file. I think they do for creating an array of objects. Some experimentation here and I will do the correct thing. I want to do a lot of the little detail stuff first and will get back to this issue later.

Also, in the MATLAB documentation they say that field names are always 32 bits long, but that is NOT what is actually saved in the mat file. It saves names in the minimum space required.

Bob
--
Robert T. Short
PhaseLocked Systems



John W. Eaton wrote:
On  5-May-2009, Robert T. Short wrote:

| Attached is a fix so that the load command works with legacy objects. | It works for binary and hdf5 formats, but the save command doesn't work | with ASCII files, so I haven't fixed the load command. Will work on | that later.

How does it fail?  It seems to work for me, at least with the simple
object I tried to save.  Note that it can't work for "save -ascii",
but that's not what the save_ascii function is for.  It is called when
saving objects in the "-text" format.  The naming is an unfortunate
historical artifact...

I would guess that the changes to handle loading from a file saved in
Octave's -text file format should be about the same as for the binary
and hdf5 formats.

What about loading from the MAT file format?  Is that working now?

| This is the last major issue with legacy objects. There are scads of | minor issues left.

I checked in this changeset with a few more minor changes.

Thanks,

jwe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]