function [row, col] = rowcol(A, lind)
%ROWCOL Row and column indexes from linear index
%   [row, col] = rowcol(A, lind) returns the row and column indexes
%   corresponding to a linear index lind for a matrix A.

[rows, cols] = size(A);
col = ceil(lind / rows);
row = lind - rows * (col - 1);
