To "subtract" two matrices with different dimensions in Octave (Matlab)
With the current version (3.6) of Octave, simply subtracting will work
> a = [1 2; 3 4; 5 6; 7 8]
> b = [1 -1]
> a - b
ans =
0 3
2 5
4 7
6 9
Edit: Apparently this will also work in Matlab starting with the upcoming release (2016b).
Solution from Stackoveflow - https://stackoverflow.com/a/1773119/38975
bsxfun(@minus, X, y);