` ind=sub2ind(arraysize,varargin)`

Inputs | |

`arraysize` |
The size of the array as a vector of integers. |

`varargin` |
The subscripts. |

Outputs | |

`ind` |
A scalar integer which is an index into the array corresponding to the subscripts. |

The result is such that for an array

`x`

of size `arrayszie`

,
`x[ind]`

and `x[varargin{1},varargin{2},varargin{3},...]`

are identical, being the
values of the same element in the array.
>>a=rand(2,4,3)>>sub2ind(size(a),1,3,2)13>>a[13]==a[1,3,2]1