library("iemisc")
import::from(pracma, ones)
xx <- list(1:26, 1:10)
numel(xx)
# Examples from GNU Octave numel
a <- 1
b <- ones(2, 3)
numel(a, b)
a <- 2
b <- ones(2, 3)
c <- ones(3, 4)
numel(a, b)
numel(a, b, c)
f <- matrix(c(10, 12, 23, 21, 62, 93), nrow = 2, ncol = 3, byrow = TRUE)
g <- c(2, 4)
numel(f, g)
if (FALSE) {
# check against GNU Octave
library(RcppOctave) # requires Octave (>= 3.2.4) and its development files
o_source(text = "
xx = {1:26, 1:10}
\
a = 1;
b = ones(2, 3);
numel(a, b)
a = 2;
b = ones(2, 3);
c = ones(3, 4);
numel(a, b)
numel(a, b, c)
f = [10 12 23; 21 62 93];
g = [2 4];
numel(f, g)
")
}
Run the code above in your browser using DataLab