num2str: Numeric to string

num2strR Documentation

Numeric to string

Description

Converts a numeric value to character. This is essentially a wrapper over base::as.character().

Usage

num2str(A, format)

## S4 method for signature 'numeric,missing'
num2str(A)

## S4 method for signature 'array,missing'
num2str(A)

## S4 method for signature 'numeric,numeric'
num2str(A, format)

## S4 method for signature 'array,numeric'
num2str(A, format)

## S4 method for signature 'numeric,character'
num2str(A, format)

## S4 method for signature 'array,character'
num2str(A, format)

Arguments

A

numeric object

format

either a number or a string (see fmt argument of base::sprintf()).

Value

A, with its format possibly reshaped by format

Methods (by class)

  • num2str(A = numeric, format = missing): Converting a vector to character

  • num2str(A = array, format = missing): Converting an array to character

  • num2str(A = numeric, format = numeric): Rounding a vector, then converting to character

  • num2str(A = array, format = numeric): Rounding an arrray, then converting to character

  • num2str(A = numeric, format = character): Formatting a vector, then converting to character

  • num2str(A = array, format = character): Formatting an array, then converting to character

Author(s)

Waldir Leoncio

Examples

X <- rnorm(10)
num2str(X)
num2str(X, 2)
A <- matrix(runif(4), 2)
num2str(A)
num2str(A, 3)
num2str(pi * 10, "%e")

matlab2r documentation built on Feb. 16, 2023, 10:39 p.m.

Related to num2str in matlab2r...