bugGNU Octave - Bugs: bug #40904, WHAT function should return all...

 
 

bug #40904: WHAT function should return all available results for MATLAB compatibility

Submitted by:  Ben Kurtz <bkurtz>
Submitted on:  Sun 15 Dec 2013 11:39:40 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: Patch SubmittedAssigned to: None
Originator Name: Ben KurtzOpen/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 15 Dec 2013 11:39:40 PM UTC, original submission:

In matlab, the what() function returns a struct array with items that correspond to 1) any matching directories in the matlab path, 2) a matching directory relative to the current directory if one exists. If there are no matching items, it returns an empty struct array.

Octave's current implementation returns the matching path (#2) if it exists, or else the first of the matching directories in the path, per (#1). If nothing is found, octave throws an error.

Attached is a patch that I believe replicates MATLAB's functionality, including:
1) creating a subfunction for extracting the info that 'what' reports to make it easier to report for multiple matches
2) concatenating (with unique()) the available matches rather than taking the first one
3) omitting the error message if no matches occur and instead returning the empty struct array.

Ben Kurtz <bkurtz>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #29930:  what_multi.patch added by bkurtz (2kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by bkurtz (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 16 Dec 2013 03:33:35 AM UTCrik5StatusNone=>Patch Submitted
    Sun 15 Dec 2013 11:39:40 PM UTCbkurtzAttached File-=>Added what_multi.patch, #29930

    Back to the top


    Powered by Savane 3.1-cleanup