Learn R Programming

matlab (version 0.7-6)

ones: MATLAB ones/zeros functions

Description

Create a matrix consisting of all ones or zeros.

Usage

ones(n, m = n)
zeros(n, m = n)

Arguments

n, m
dimensions for the result

Value

  • Returns matrix consisting only of ones (or zeros). Defaults to square if second dimension argument m not provided.

Examples

Run this code
ones(3)
zeros(3)

Run the code above in your browser using DataLab