%% Subscripts of Multidimensional Array
% Find the nonzero elements in a 4-by-2-by-3 array. Specify two outputs, row and col, to return the row and column subscripts of the nonzero elements. When the input is a multidimensional array (N > 2), find returns col as a linear index over the N-1 trailing dimensions of X.

X = zeros(4,2,3);
X([1 12 19 21]) = 1

%

[row,col] = find(X)

% Copyright 2015 The MathWorks, Inc.