octave-maintainers
[Top][All Lists]
Advanced

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

Re: XML tools for Octave


From: John W. Eaton
Subject: Re: XML tools for Octave
Date: Wed, 28 Jun 2006 23:18:57 -0400

On 28-Jun-2006, Andy Adler wrote:

| On Wed, 21 Jun 2006, Schloegl Alois wrote:
| 
| > In order to be useful, the parsed data need to be converted to a Octave 
| > variable with nested structs. Are you going to implement this?
| 
| I'm trying to write this. My idea is that XML like this
| <a b="c" d="e"> text <f g="h"/> more text <f>data</f> </a>
| 
| will load into octave as
| 
|      v= xmlparse( filename)
| 
| with:
|      v.a.ATTS.b      => "c"
|      v.a.ATTS.d      => "e"
|      v.a.TEXT        => " text  more text  "
|      v.a.f(1).ATTS.g => "h"
|      v.a.f(2).TEXT   => "data"
| 
| Now I need someone to give me some help with octave internals.
| The output is a struct of cells.
| 
| There are some good examples on structs and cells in 
| "Dal Segno al Coda". However, I need to be able to 
| append to a cell array. I don't see how to do this.
| 
| Could anyone offer some pointers to help me?

A cell array is just 

  class Cell : public ArrayN<octave_value>

so you can resize it the same as you would any other Array object:

  #include <octave/oct.h>
  #include <octave/Cell.h>

  DEFUN_DLD (celltst, , , "")
  {
    Cell c;

    octave_idx_type nr = 1;
    octave_idx_type nc = 10;

    c.resize (dim_vector (nr, nc));

    std::cerr << c.rows () << std::endl;
    std::cerr << c.columns () << std::endl;

    return octave_value ();
  }

jwe




reply via email to

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