From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 23 07:39:46 2001 Subject: Octave_map question. From: Douglas Eck To: "help-octave at bevo dot che dot wisc dot edu" 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 #include 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 #include 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 -------------------------------------------------------------