Last data update: 2014.03.03

R: Create a mesh grid like in Matlab
meshgridR Documentation

Create a mesh grid like in Matlab

Description

Creates 2D matrices for accessing images and 2D matrices

Usage

meshgrid(a, b)

Arguments

a

x vector components

b

y vector components

Details

returns outer product of x-compnents and y-components for use as index arrays

Value

x

length(y) by length(x) matrix of x indicies

y

length(y) by length(x) matrix of y indicies

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

Examples


meshgrid(1:5, 1:3)


Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AtmRay)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AtmRay/meshgrid.Rd_%03d_medium.png", width=480, height=480)
> ### Name: meshgrid
> ### Title: Create a mesh grid like in Matlab
> ### Aliases: meshgrid
> ### Keywords: misc
> 
> ### ** Examples
> 
> 
> meshgrid(1:5, 1:3)
$x
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    2    3    4    5
[2,]    1    2    3    4    5
[3,]    1    2    3    4    5

$y
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    1    1    1    1
[2,]    2    2    2    2    2
[3,]    3    3    3    3    3

> 
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>