# repmat (19)

I would like to execute the equivalent of the following MATLAB code using NumPy: repmat([1; 1],[1 1 1]). How would I accomplish this?…

Let's say I have a one-dimensional array: a=[1, 2, 3]; Is there a built-in Matlab function that takes an array and an integer n and replicates each element of the array n times? For example calling…

Is there a way to extend a vector by making it repeat itself?>v=[1 2];>v10=v x 5; %x represents some function. Something like "1 2" x 5 in perl Then v10 would be:>v10 1 2 1 2 1 2 1 2 1 2…

I'm trying to find some way to substract a size 3 vector from each column of a 3*(a big number) matrix in Matlab. Of course I could use a loop, but I'm trying to find some more efficient solution, a…

In Haskell, if I wanted to get a 10 element list which only contained the number 5, I could do something like this: take 10 \$ repeat 5 Output:[5,5,5,5,5,5,5,5,5,5] Is there anything like this in Ma…

Simple question here: I'm trying to get an array that alternates values(1,-1, 1,-1.....) for a given length. np.repeat just gives me(1, 1, 1, 1,-1,-1,-1,-1). Thoughts?…

I'm trying to port some of my code from matlab to python, and some of it uses the bsxfun() function for virtual replication followed by multiplication or division(I also use it for logical operation…

This question already has an answer here: Octave/Matlab: Extend a vector making it repeat itself? 2 answers I have a vector, e.g. vector=[1 2 3] I wo…

My Question: I've noticed that a lot of good answers to Matlab questions on SO frequently use the function bsxfun. Why? Motivation: In the Matlab documentation for bsxfun, the following example is pro…

This question already has an answer here: Element-wise array replication in Matlab 7 answers I am looking for a function that behaves similarly to the rep…