%% Convert Linear Indices to Subscripts for Three-Dimensional Array
% Convert the linear indices [3 4 5 6] to subscripts in a 2-by-2-by-2 array. The mapping from linear indices to subscripts (indexing by position) for a 2-by-2-by-2 array can be illustrated as in the following.
%
% Create input vectors and perform the conversion.

ind = [3 4 5 6];
sz = [2 2 2];
[I1,I2,I3] = ind2sub(sz,ind)

% Copyright 2019 The MathWorks, Inc.