Siyi's metaphysical stuff
Monday, May 11, 2009
Matlab: Vector operation
OP here.
Q:
Is there a vectorized way for this code?
for i=1:size(m,2)
m(:,i) = m(:,i).*v(i);
end
A1:
mv = bsxfun(@times,m,v');
A2:
mv = m*diag(v);
all these solutions are much better than using
repmat
etc.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Siyi
View my complete profile
Followers
Blog Archive
►
2010
(7)
►
March
(5)
►
February
(2)
▼
2009
(34)
►
September
(1)
►
July
(7)
►
June
(6)
▼
May
(20)
Matlab: Vector indexing;
Matlab: vector indexing;
Matlab: indexing; find first value in each row
Matlab: matrix indexing; find duplicate entries in...
Matlab: Block randomization
Matlab: Vector operation
Matlab: Matrix Indexing
EEG: Topographic contour on 3d head model.
Matlab: Vectorization.
Matlab: Vector manipulation.
Matlab: Vector indexing;
Matlab: Matrix Indexing
DSP: How to understand convolution.
Matlab: Matrix manipulation.
Matlab: Vector manipulation.
Matlab: Split a vector into continuous chunks.
Matlab: Automatic conversion to element-by-element...
Matlab: Including function definitions when Publis...
Matlab: Product Support 1109 - Code Vectroization ...
Matlab: search via command line
No comments:
Post a Comment