[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Octave_map question.
From: |
Douglas Eck |
Subject: |
Octave_map question. |
Date: |
Tue, 23 Jan 2001 14:39:40 +0100 |
In 2.1.32 this code works fine. Just call it with something like
Octave2.1>testMap(struct('member',rand(10,10)))
#include <octave/oct.h>
#include <octave/ov-struct.h>
DEFUN_DLD (testMap, args, ,"Just testing.")
{
octave_value_list retval;
Octave_map s = args(0).map_value();
cout << s["member"].matrix_value() << endl;
return retval;
}
*But* if we declare s and then assign it, the
program segfaults:
#include <octave/oct.h>
#include <octave/ov-struct.h>
DEFUN_DLD (testMap, args, ,"Just testing.")
{
octave_value_list retval;
Octave_map s;
s = args(0).map_value();
cout << s["member"].matrix_value() << endl;
return retval;
}
Thus, I cannot do this (i.e. declare Octave_map s outside of an if statement
and assign it inside the if statement):
Octave_map s;
if (nargin>0 && args(0).is_map()
)
s = args(0).map_value();
What should I change?
-Doug
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Octave_map question.,
Douglas Eck <=