help-octave
[Top][All Lists]
Advanced

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

Octave Classes Usage


From: Pablo Daniel Pareja Obregon
Subject: Octave Classes Usage
Date: Thu, 24 Jun 2010 19:41:21 -0300
User-agent: KMail/1.13.3 (Linux/2.6.32-5-686; KDE/4.4.4; i686; ; )

Hi everyone,

I'm trying to use octave class function to define my own structure to hold 
properties and data. I searched for examples on the web, and what I found so 
far is something like this:

@foo/foo.m:
function obj = foo()
   obj.name = "foo" ;
   obj = class(obj, "foo") ; 

However, when invoking x = foo() from the command line typeinfo(x) returns 
"class" when it should be "foo". After creating x, if I try to access any 
fields (for example issuing the command x.name), I get the following error:

error: invalid index for class

Finally, if I try to modify any field in x (x.name = "John"), octave crashes. 
with the following message:

panic: Segmentation fault -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete
Segment fault

I am currently using Debian Testing, and my octave version is 3.2.4-4.

Am I using the class in the correct way? Is it a bug? Thanks in advance.

Regards,
Pablo


reply via email to

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