# bug #53178: Circshift incompatibility with MATLAB

 Submitted by: Ceral Paquet Submitted on: Sat 17 Feb 2018 03:00:22 PM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: Matlab Compatibility Status: Fixed Assigned to: None Originator Name: Open/Closed: Closed Release: dev Operating System: GNU/Linux

Add a New Comment

You are not logged in

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

## Discussion

Sat 01 Dec 2018 10:35:15 AM UTC, comment #5:

I checked in a cset for this here (https://hg.savannah.gnu.org/hgweb/octave/rev/8be616a0b9aa).

Marking as fixed and closing report.

Rik <rik5>
Sun 18 Mar 2018 01:57:01 PM UTC, comment #4:

Sorry that logic was busted, trying to be clever. This is a simpler fix for scalar "n" arguments.

diff circshift.m circshift_new.m

< function y = circshift (x, n, dim)
---

> function y = circshift_new (x, n, dim)

75a76,81

> if (isscalar (n))
> ## Find the first non-singleton dimension.
> (dim = find (sz > 1, 1)) || (dim = 1);
> n = [zeros(1, dim-1), n];
> end
>

Ceral Paquet <octavebugs>
Thu 15 Mar 2018 10:14:36 PM UTC, comment #3:

The diff was kind of terse! ;) In context:

Ceral Paquet <octavebugs>
Thu 15 Mar 2018 10:11:27 PM UTC, comment #2:

This change to circshift.m allows a scalar "n" argument that acts along the first non-singleton dimension.

Ceral Paquet <octavebugs>
Sat 17 Feb 2018 03:23:28 PM UTC, comment #1:

Aha, now I see why this never bit us before!

Ceral Paquet <octavebugs>
Sat 17 Feb 2018 03:00:22 PM UTC, original submission:

With a vector input and singleton shift argument, MATLAB always shifts whereas Octave respects the dimension.

MATLAB 2017a

Octave 4.2.1

Ceral Paquet <octavebugs>

## Attached Files

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

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

## Mail Notification Carbon-Copy List

Carbon-Copy List
• -email is unavailable- added by rik5 (Posted a comment)
• -email is unavailable- added by mtmiller (Updated the item)
• -email is unavailable- added by octavebugs (Submitted the item)
•

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

Only project members can vote.

## History

Follow 5 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2018-12-01 rik5 Open/ClosedOpen Closed
2018-12-01 rik5 StatusNone Fixed
Release4.2.1 dev
2018-03-20 mtmiller CategoryNone Octave Function
Item GroupWTF, Matlab?!? Matlab Compatibility