Skip to content
This repository was archived by the owner on May 21, 2020. It is now read-only.
Florian Rappl edited this page Dec 21, 2014 · 2 revisions

size

Outputs the dimensions (size) of the given object.

size(M)

Returns a row vector containing the number of rows (1, 1) and the number of columns (1, 2).

Argument M

Matrix

Returns 1. entry

Matrix

Example

size([1,2,3,4,5])

Results in a vector with the elements 1 and 5, since we have 5 columns and 1 row.

Example

size(rand(2))

Results in a vector with the elements 2 and 2, since we have 2 columns and 2 rows.

size(x)

Returns a row vector containing the number of rows (1, 1) and the number of columns (1, 2), which is 1 and 1 for any scalar.

Argument x

Scalar

Returns 1. entry

Matrix

size(str)

Returns a row vector containing the number of rows (1, 1) and the number of columns (1, 2), which is 1 and the number of characters for any string.

Argument str

String

Returns 1. entry

Matrix

Example

size("hello")

Results in a vector with the elements 1 and 5, since we have 5 charaters.

Clone this wiki locally