About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/_reshape.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 _reshape Context: slangrtl

Synopsis

Copy an array to a new shape

Syntax

Array_Type _reshape (Array_Type A, Array_Type I)

Description

The _reshape function creates a copy of an array A, reshapes it to the form specified by I and returns the result. The elements of I specify the new dimensions of the copy of A and must be consistent with the number of elements A.

Example

If A is a 100 element 1-d array, a new array 2-d array of size 20 by 5 may be created from the elements of A by

      A = _reshape (A, [20, 5]);

In this example, the original array was no longer needed. Hence, it is preferable to make use of the __tmp operator to avoid the creation of a new array, i.e.,

      A = _reshape (__tmp(A), [20,5]);

The reshape function performs a similar function to _reshape. In fact, the _reshape function could have been implemented via:

     define _reshape (a, i)
     {
        a = @a;     % Make a new copy
        reshape (a, i);
        return a;
     }
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.