I want a function f such that (outer(X, Y, f))[i, j] is a side-by-side concatenation of the i-th element of X and the j-th element of Y, something like c(X[i], Y[j]), or having a similar structure.
Take this simple example: a = [1 2i]; x = zeros(1,length(a)); for n=1:length(a) x(n) = isreal(a(n)); end In an attempt to vectorize the code, I tried:
This question already has answers here: Repeat copies of array elements: Run-length decoding in MATLAB