bugGNU Octave - Bugs: bug #53363, Error at loading mat file created...

 
 

bug #53363: Error at loading mat file created in matlab with function handles to nonexistent functions

Submitter:  avlas <kupiqu>
Submitted:  Fri 16 Mar 2018 05:25:40 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 18 Apr 2019 05:08:09 PM UTC, comment #11: 

Great, thanks Mike.

avlas <kupiqu>
Thu 18 Apr 2019 04:26:44 PM UTC, comment #10: 

Yes, this works, closing as fixed.


>> load pseudo_anonymous_function_matfile.mat
>> pseudo_anonymous_function
pseudo_anonymous_function = @afun
>> pseudo_anonymous_function()
error: afun: invalid function handle


Mike Miller <mtmiller>
Group Member
Thu 18 Apr 2019 06:55:59 AM UTC, comment #9: 

Testing in the Default branch is not easy for me. I've tested this in Octave 5.1 and (perhaps not surprisingly) the issue is still there.

Mike, could you please check it out with the matfile attached?

Thanks!

(file #46793)

avlas <kupiqu>
Sat 13 Apr 2019 07:05:35 PM UTC, comment #8: 

This bug should be fixed on the default branch of Octave now, since function handles to nonexistent functions are supported now.

Can you test this with Octave default branch, or at least attach a test file that shows this problem with an older version of Octave?

Mike Miller <mtmiller>
Group Member
Tue 20 Mar 2018 01:31:57 PM UTC, comment #7: 

Thanks for linking this bug to previous ones. I wasn't aware of those.

I understand and very much respect that Octave devs are against supporting function handles to nonexisting functions (they don't make much sense, I agree). However, I think some sort of workaround is needed for being able to load existing mat files that trigger such issue, so Octave users can access the (rest of the) data, ideally informing the user about what variables (empty function handles) are missing and why.

avlas <kupiqu>
Sun 18 Mar 2018 07:49:45 PM UTC, comment #6: 

Hi Mike,

Thanks for the title update. I couldn't find the way to do it myself (I am a newbie using savannah).

IMO, there are actually two potential errors with function handles:

1. when the function handle refers to a m-file that does not exist (it could have been in the system that created the mat file but it is not in the system loading it)

Perhaps you are referring to this case (?)

2. when the function handle refers to really nothing

avlas <kupiqu>
Sun 18 Mar 2018 07:33:03 PM UTC, comment #5: 

Thanks, I've updated the bug title. So the error is in loading a mat file that contains a function handle to a function that you don't have in your load path.

Mike Miller <mtmiller>
Group Member
Sun 18 Mar 2018 12:56:22 PM UTC, comment #4: 

In my opinion, this opens two points for discussion:

1- Whether or not Octave allows such function handles (regarding Matlab compatibility).

2- If it would make more sense to extract as much info from a mat file as possible as well as to display the error for the variables that could not be loaded.

So far only the (first encountared) error is shown and no data is available.

From an octave user point of view, these pseudo function handles may be totally irrelevant (as it was the case for me), however this error does not allow me to have access to the relevant data in the mat file.

avlas <kupiqu>
Sun 18 Mar 2018 12:44:49 PM UTC, comment #3: 

I found the issue. The problem occurs with Matlab mat files containing variables like this:

"

>> pseudo_anonymous_function = @afun


pseudo_anonymous_function =

  function_handle with value:

    @afun

>>

"

They work just fine in Matlab (you can create them, save and load with no issue). Octave doesn't like those, you cannot create them:

"

>> pseudo_anonymous_function = @afun

error: @afun: no function and no method found

>>

"

And same error occurs when trying to load a mat file that contains one of these variabels

avlas <kupiqu>
Fri 16 Mar 2018 06:46:30 PM UTC, comment #2: 

I just use: load mat_filename

I need to ask for permission to upload that mat file, as it is not mine. I cannot build a new one for futher testing as I don't have a mac osx system. What I can say is that this doesn't happen with all mat files from mac.

I know that you won't be able to do much if I cannot upload the file, but at least you are now aware that there is an issue here.

If I get permission I will certainly add the file.

avlas <kupiqu>
Fri 16 Mar 2018 06:21:23 PM UTC, comment #1: 

Can you please show what command you are using to load the file?

Can you attach the file, or a constructed example of a file that shows this behavior on your system?

Mike Miller <mtmiller>
Group Member
Fri 16 Mar 2018 05:25:40 PM UTC, original submission:  


When trying to load the file I get the following error:
error: no such file, '/Users/XXX/xxx.m'

I modified the username by XXX and the filename by xxx

Wondering, isn't it weird that it tries to find a "m" file at loading the content of a mat file?

If I try to load the file in matlab, it just works. R enters in a sort of never-ending loop eating all CPU. Octave is not functional but at least doesn't behave that badly.

This is a MATLAB 5.0 MAT-file, Platform: MACI64

avlas <kupiqu>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #46793:  pseudo_anonymous_function_matfile.mat added by kupiqu (354B - application/octet-stream)

 

Carbon-Copy List
  • -email is unavailable- added by kupiqu (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-18 mtmiller StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-04-18 kupiqu Attached File- Added pseudo_anonymous_function_matfile.mat, #46793
    2019-04-13 mtmiller Carbon-CopyRemoved 80942 -
    2019-04-13 mtmiller StatusNeed Info Ready For Test
    2018-03-18 siko1056 Dependencies- Depends on bugs #31821
    2018-03-18 siko1056 Dependencies- Depends on bugs #52568
    2018-03-18 mtmiller SummaryError at loading mat file created in matlab in mac osx Error at loading mat file created in matlab with function handles to nonexistent functions
    2018-03-16 mtmiller CategoryNone Interpreter
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code