# bug #52001: error assigning to a slice of a 3d matrix

 Submitter: Carlo de Falco Submitted: Tue 12 Sep 2017 01:06:47 PM UTC Category: Interpreter Severity: 3 - Normal Priority: 5 - Normal Item Group: Matlab Compatibility Status: Confirmed Assigned to: None Originator Name: Open/Closed:  * Open Release:  * dev Operating System:  * Any Fixed Release: None Planned Release: None
* Mandatory Fields

Add a New Comment Rich Markup

## Discussion

Tue 12 Sep 2017 10:08:10 PM UTC, comment #2:

Confirmed.  I can probably understand why as well.  Since the variable doesn't exist, all trailing dimensions are probably set to 1 so the implied size is 0x0x1.  The ':' indexing operator selects that last dimension, but it has size of one versus a size of three.  This squares with the error message issued

nonconformant arguments (op1 is 0x0x1, op2 is 2x3)

I'm guessing that this would be relatively hard to solve since it involves adding a very special corner case.

Rik <rik5>
Tue 12 Sep 2017 01:53:50 PM UTC, comment #1:

interesting.  it works (in 4.2.1) if you specify the 3rd range:

>> q(1,3:4,1:3) = ones(1, 2, 3)
q =
ans(:,:,1) =
0     0     1     1

ans(:,:,2) =

0     0     1     1

ans(:,:,3) =

0     0     1     1

Nicholas Jankowski <nrjank>
Tue 12 Sep 2017 01:06:47 PM UTC, original submission:

The following works in matlab (2016b):

>> clear all
>> q(1,3:4,:) = ones(1, 2, 3)

q(:,:,1) =

0     0     1     1

q(:,:,2) =

0     0     1     1

q(:,:,3) =

0     0     1     1

while in Octave 4.3+ it produces an error

>> clear all
>> q(1,3:4,:) = ones(1, 2, 3)
error: =: nonconformant arguments (op1 is 0x0x1, op2 is 2x3)

Carlo de Falco <cdf>

## 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

Carbon-Copy List
• -email is unavailable- added by rik5 (Posted a comment)
• -email is unavailable- added by nrjank (Posted a comment)
• -email is unavailable- added by cdf (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.

## History

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2017-09-12 rik5 StatusNone Confirmed