About resize() function

Bill Denney bill at denney.ws
Thu Oct 23 17:02:49 CDT 2008


José Luis García Pallero wrote:
> But in fact, not is a destructive resize, or I didn't understand what
> *Values in X are not preserved as they are with `reshape'.* means.
> For example, if:
>
> a=[1 2;3 4];
> resize(a,3,3) returns:
>
> 1 2 0
> 3 4 0
> 0 0 0
>
> Is the function wrong or the help
Both are correct if you do things a little differently.  Values are not
preserved if you make the matrix smaller.  Try the following:

a = [1 2;3 4];
resize(a, 1, 3)

Have a good day,

Bill


More information about the Help-octave mailing list