GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • » Octave core
  • » by package
  • » alphabetical

This view

  • Original page
  • New address

GeezerVison is showing octave.sourceforge.io — Function Reference: size

Octave-Forge - Extra packages for GNU Octave
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code

Navigation

Operators and Keywords

Function List:

  • » Octave core
  • » by package
  • » alphabetical

C++ API

: sz = size (a)
: dim_sz = size (a, dim)
: [rows, cols, …, dim_N_sz] = size (…)

Return a row vector with the size (number of elements) of each dimension for the object a.

When given a second argument, dim, return the size of the corresponding dimension.

With a single output argument, size returns a row vector. When called with multiple output arguments, size returns the size of dimension N in the Nth argument. The number of rows, dimension 1, is returned in the first argument, the number of columns, dimension 2, is returned in the second argument, etc. If there are more dimensions in a then there are output arguments, size returns the total number of elements in the remaining dimensions in the final output argument.

Example 1: single row vector output

size ([1, 2; 3, 4; 5, 6])
  ⇒ [ 3, 2 ]

Example 2: number of elements in 2nd dimension (columns)

size ([1, 2; 3, 4; 5, 6], 2)
   ⇒ 2

Example 3: number of output arguments == number of dimensions

[nr, nc] = size ([1, 2; 3, 4; 5, 6])
   ⇒ nr = 3
   ⇒ nc = 2

Example 4: number of output arguments != number of dimensions

[nr, remainder] = size (ones (2, 3, 4, 5))
   ⇒ nr = 2
   ⇒ remainder = 60

See also: numel, ndims, length, rows, columns, size_equal, common_size.

Package: octave

SourceForge.net Logo
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.