How would one superimpose rows of different lengths onto a matrix in Matlab? That is, I would like the first x number of elements and the last y number of elements in row z of matrix A to be zero with x and y specified in two column vectors of length Z (so corresponding to the number of rows of matrix A). I can only think of a solution in terms of a simple loop but am looking for a more elegant solution avoiding the use of a loop as this piece of code needs to be run thousands of times in a main loop.
Edit
As confirmed by @randomatlabuser, this is what the asker wants to do without a loop:
M = 1e4; N = 1e3; A = randn(M, N);
x = randi([0, N], [M, 1]);
y = randi([0, N], [M, 1]);
for hh = 1:M
A(hh, 1:x(hh)) = 0;
A(hh, (N - y(hh) + 1):N) = 0;
end