octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #36686] Saving and loading function handles th


From: Giulio Mancuso
Subject: [Octave-bug-tracker] [bug #36686] Saving and loading function handles that point to subfunctions is not working correctly
Date: Tue, 19 Jun 2012 19:20:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11

URL:
  <http://savannah.gnu.org/bugs/?36686>

                 Summary: Saving and loading function handles that point to
subfunctions is not working correctly
                 Project: GNU Octave
            Submitted by: giuliosssup
            Submitted on: Tue 19 Jun 2012 07:20:23 PM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Build Failure
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I found a strange behavior using function handles in Octave.

Here is what I'm trying to do:

1) Create a function handle in a structure like:

    model.odefun = @plant_ODE

2) Save the handle

    save stored_model.mat model

3) when I try to call the function:

    load stored_model.mat;
    model.odefun(0,[2 4]);

octave does not recognize "model.odefun" as an handle anymore.

Actually the problem is a little bit more complex. Attached is a small
example. It works in Matlab but it doesnt in Octave. 


clear all
close all
clc

model = create_func;
model.odefun([2 3],0)

save -binary handle_saved.dat model
clear all

load handle_saved.dat
model.odefun([2 3],0)



function [model] = create_func

 model.odefun = @gas_phase_ODE;

end


function dxdt = gas_phase_ODE(x,t)
  k_ = 0.16;
  v = [-2 1];
  r = k_*x(1)^2;
  dxdt = v'*r;
end





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 19 Jun 2012 07:20:23 PM GMT  Name: main.m  Size: 161B   By:
giuliosssup

<http://savannah.gnu.org/bugs/download.php?file_id=26064>
-------------------------------------------------------
Date: Tue 19 Jun 2012 07:20:23 PM GMT  Name: create_func.m  Size: 178B   By:
giuliosssup

<http://savannah.gnu.org/bugs/download.php?file_id=26065>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36686>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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