% returns the tensor obtained by inserting the given matrix m
% into slice s orthogonal to dimension d in tensor t

function t = tputmatrix(t,s,d,a)

if (d < 1 | d > 3),
  error('d must be between 1 and 3')
end

[ta to] = tmat2ten(a,d);
from = ones(3,1);
from(d) = s;
to(d) = s;
t = tputsubtensor(ta,t,from(1):to(1),from(2):to(2),from(3):to(3));
