# bug #57533: Incorrect error message when assigning to a subset of a 3+ dimensional array

 Submitted by: Clint Submitted on: Fri 03 Jan 2020 08:25:37 PM UTC Category: Interpreter Severity: 2 - Minor Priority: 5 - Normal Item Group: Other Status: Confirmed Assigned to: None Originator Name: Clint Open/Closed: Open Release: dev Operating System: Any

## Post a Comment

Add a New Comment

You are not logged in

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

## Discussion

Spam posted by _174830
Sat 04 Jan 2020 12:11:37 AM UTC, comment #1:

Confirmed.  Matlab, as well as Octave in the 2-D case, get it right.

This is probably something about reporting the dimensions of the original base matrix, rather than the dimensions of the object after indexing.  As an example of that,

octave:21> a = zeros (3,4,5);
octave:22> b = ones (2,2);
octave:23> a(1,:,2) = b
error: =: nonconformant arguments (op1 is 3x4x5, op2 is 2x2)

Rik <rik5>
Fri 03 Jan 2020 08:25:37 PM UTC, original submission:

When making an assignment to a subset of a higher-dimensional array, the error message can list incorrect dimensionality for op1.  The error message is correct when the matrix receiving the assignment has only two dimensions.

Example of code giving incorrect error:

a = zeros(2, 2, 1);
b = ones(2, 2);
a(1, :, 1) = b;
>> error: =: nonconformant arguments (op1 is 2x2x1, op2 is 2x2)

But it is readily apparent that op1 is actually 1x2x1.

In contrast, when a is 2x2:

a = zeros(2, 2);
b = ones(2, 2);
a(1, :) = b;
>> error: =: nonconformant arguments (op1 is 1x2, op2 is 2x2)

Here, the error message correctly reports the dimensionality of the subset of a that is being assigned to.

I've seen the same behavior in version 5.1.0 on Windows 10 and in version 4.2.2 on Ubuntu Linux.

Clint <terikin>

## 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 terikin (Submitted the item)
•

## Votes

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
2020-01-08 mtmiller Carbon-CopyRemoved 174830 -
2020-01-04 rik5 Severity3 - Normal 2 - Minor
Item GroupNone Other
StatusNone Confirmed
Release5.1.0 dev

Powered by Savane 3.5