patchGNU Octave - Patches: patch #10440, Allow unique to process cellstr...


patch #10440: Allow unique to process cellstr arrays with the 'rows' option

Submitter:  Andreas Bertsatos <pr0m1th3as>
Submitted:  Sun 17 Mar 2024 01:48:11 AM UTC
Category:  Core : new feature Priority:  5 - Normal
Status:  In Progress Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Sun 17 Mar 2024 11:43:46 PM UTC, comment #1: 

here's a modified patch which will apply cleanly to the current default branch. 

this seems like a worthwhile extension to unique.  I wasn't able to break it or cause any other problems after the change.

There will be a potential compatibility issue, as currently for a cellstring array A, unique(A,'rows') returns the same as unique(A). Matlab is also pretty explicit in it's help for unique that 'rows' does not work for cell arrays. Does anyone know if there are particular problems supporting cellstrings would cause?

running the test suite now to see if it triggers any other issues, but don't expect any.

(file #55857)

Nicholas Jankowski <nrjank>
Group Member
Sun 17 Mar 2024 01:48:11 AM UTC, original submission:  

I have modified the unique function to handle cellstr arrays with the rows option. The modified function (see attachment) includes two extra BISTs for the new functionality and a minor adjustment in the documentation regarding the “rows” option. I have attached a patch file 'unique.diff'.

This is an Octave extension, since MATLAB does not support this functionality. Another issue about MATLAB's unique implementation is that it does not allow a combination of 'sorted'/'stable' and 'first'/'last' options. Octave behaves the same. As a result, if we opt for 'first'/'last', these are always computed with 'sorted' by default, which is a bit annoying since there are cases that some extra flexibility would be very useful. Are we interested in obtaining this extra functionality? If so, I could work on this and submit another patch.

Andreas Bertsatos <pr0m1th3as>


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

Attach Files:

Attached Files
file #55857:  unique_cellstr_rows_patch10440.patch added by nrjank (3KiB - application/octet-stream - patch against default (hg id ce6d586e18c4))
file #55848:  unique.diff added by pr0m1th3as (2KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nrjank (Updated the item)
  • -email is unavailable- added by pr0m1th3as (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 logged-in users can vote.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-17 nrjank Attached File- Added unique_cellstr_rows_patch10440.patch, #55857
        StatusNone In Progress
    2024-03-17 pr0m1th3as Attached File- Added unique.diff, #55848

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code