I have a matrix R = zeros(4,5,3) and I want to make the last column of each matrix a different number. such that given C is a vector

for n = 1: end R(:,end, n) = C(n)

I managed a solution where I have a column vector A which if I could substitute into R(:, end, :), but it says mismatch dimensions.

essentially, I want to substitute a column vector into the columns of a 3D matrix R without using a for loop.

## Best Answer