help-octave
[Top][All Lists]
Advanced

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

create struct array in oct-file


From: Andy Buckle
Subject: create struct array in oct-file
Date: Sat, 12 Jun 2010 15:28:28 +0100

My (simplified) dysfunctional attempt is below. I am sure this is
easy, but I can't figure it out.

#include "octave/oct.h"
#include "octave/ov-struct.h"

DEFUN_DLD (create_struct_array, args, nargout,
                "example of struct array") {
        octave_value_list retval;
        const int n=2;
        int i;
        Array2<Octave_map> aom(n,1);
        for (i=0; i<n; i++) {
                Octave_map om;
                om.assign("a",i);
                om.assign("b",i+1);
                aom(i,1)=om;
        }
        retval(0)=Cell(aom);
        return retval;
}

This fails to compile, with:
create_struct_array.cpp:16: error: call of overloaded
‘Cell(Array2<Octave_map>&)’ is ambiguous

I am afraid my C++ is weak.

-- 
/* andy buckle */



reply via email to

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