Nassign
From Eigenvector Documentation Wiki
Contents |
Purpose
Generic subscript assignment indexing for n-way arrays.
Synopsis
- x = nassign(x,xnew,indices,modes)
Description
NASSIGN allows index assignments into an n-way array without concern tothe actual number of modes in the array. Requires n-way array (x), a matrix to be inserted (xnew), a cell of requested indices (indices) (e.g.{[1:5] [10:20]} ) and the modes to which those indicies should be applied (modes). Any additional modes not specified in (indices) will be returned as if reffered to as ':' and returned in full. If (modes) omitted, it is assumed that indices should refer to the first modes of (x) up to the length of (indices). The size of (xnew) must match the size indicated by (indices) as well as those indices not specified.
Examples
x = nassign(x,xnew,{1:5}); %insert xnew as rows 1:5 of a n-way array x x = nassign(x,xnew,{1:5},3); %insert xnew as indices 1:5 from mode 3 of a n-way array x x = nassign(x,xnew,{1:10 1:5},[5 8]); %insert xnew as 1:10 from mode 5 and 1:5 from mode 8 % Note, the use cell notation can be omitted on indices if only one mode is % being indexed: x = nassign(x,xnew,5:10,3); %is valid