bugGNU Octave - Bugs: bug #46736, Resorting of cell delivers...

 
 

bug #46736: Resorting of cell delivers incorrect result when stored in variable

Submitter:  None
Submitted:  Mon 21 Dec 2015 10:05:43 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Invalid / Not an Octave Bug Assigned to:  siko1056
Originator Name:  Andreas Beschorner Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.0.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 21 Dec 2015 12:18:34 PM UTC, comment #1: 

For cell indexing, I like to point to the manual for a few examples:

https://www.gnu.org/software/octave/doc/interpreter/Indexing-Cell-Arrays.html#Indexing-Cell-Arrays

As you have seen in your code example ll{[2,1]} produces two "ans" variables. It is not a single result! Using ans afterwards will only take the last of the rows. To capture all the results from the cell indexing, try


>> lk=[ll{[2,1]}]
lk =

 Columns 1 through 14:

    3    8    1    2    9   10    6    5    7    4    1    2    3    4

 Columns 15 through 20:

    5    6    7    8    9    0


this produces a vector with all results. But, I guess, the more desired outcome is


lk = cell2mat (ll')
lk =

    1    2    3    4    5    6    7    8    9    0
    3    8    1    2    9   10    6    5    7    4


HTH, Kai

Kai Torben Ohlhus <siko1056>
Group Member
Mon 21 Dec 2015 10:05:43 AM UTC, original submission:  

When using the result of a resorted cell as a variable, only the very first element is copied. How to reproduce in the GUI; "ans" and "lk" (see below) should be identical:



>> m
m =

   1   2   3   4   5   6   7   8   9   0

>> n
n =

    3    8    1    2    9   10    6    5    7    4

>> ll={m, n}
ll =
{
  [1,1] =

     1   2   3   4   5   6   7   8   9   0

  [1,2] =

      3    8    1    2    9   10    6    5    7    4

}
>> ll{[2,1]}
ans =

    3    8    1    2    9   10    6    5    7    4

ans =

   1   2   3   4   5   6   7   8   9   0

>> lk=ll{[2,1]}
lk =

    3    8    1    2    9   10    6    5    7    4

>>


Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-21 siko1056 Assigned toNone siko1056
    2015-12-21 siko1056 Item GroupIncorrect Result Other
        StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code