Learn R Programming

PopED (version 0.3.0)

ones: Creates a matrix of ones

Description

Function creates a matrix of ones of size (dim1 x dim2). Written to match MATLAB's ones function.

Usage

ones(dim1, dim2 = NULL)

Arguments

dim1
The dimension of the matrix (if square) or the number of rows.
dim2
The number of columns

Value

A matrix of ones

See Also

Other MATLAB: cell, diag_matlab, feval, fileparts, isempty, isfield, randn, randperm, rand, size, tic, toc, zeros

Examples

Run this code

ones(4)
ones(3,4)

Run the code above in your browser using DataLab