octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #63682] mat2cell returns incorrect vale for nd


From: Mario Storti
Subject: [Octave-bug-tracker] [bug #63682] mat2cell returns incorrect vale for ndims>2
Date: Thu, 19 Jan 2023 05:34:14 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63682>

                 Summary: mat2cell returns incorrect vale for ndims>2
                 Project: GNU Octave
               Submitter: mstorti
               Submitted: Thu 19 Jan 2023 10:34:12 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Mario Storti
        Originator Email: 
             Open/Closed: Open
                 Release: 7.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 19 Jan 2023 10:34:12 AM UTC By: Mario Storti <mstorti>
I found that mat2cell is not working as I would expected when the rank of the
array is >2.

In the following example I want to split an array of 4x2x2 along the first
dimension and I would expect a cell containing two matrices of 2x2x2


octave> z = reshape(1:16,4,2,2)
z =

ans(:,:,1) =

   1   5
   2   6
   3   7
   4   8

ans(:,:,2) =

    9   13
   10   14
   11   15
   12   16

octave> mat2cell(z,[2,2])
ans = {}(2x0)



I would expect this


>> m = mat2cell(z,[2,2])

m =

  2×1 cell array

    {2×2×2 double}
    {2×2×2 double}

>> m{1}

ans(:,:,1) =

     1     5
     2     6


ans(:,:,2) =

     9    13
    10    14

>> m{2}

ans(:,:,1) =

     3     7
     4     8


ans(:,:,2) =

    11    15
    12    16


OS: Fedora 37 KDE
Octave version: 7.2.0
Installation method: Fedora RPM package









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63682>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]