Vectorization

1 次查看(过去 30 天)
Aravin
Aravin 2012-4-15
Dear Community,
Let say I have Matrix M. In Matrix M, each Column is feature of Image. Now what I want to get a binary matrix B by following way.
for given image feature i:
B(1,i) = M(1,i) >= M(2,i);
its mean for each image feature, each cell is compared to its next cell. I want to do it without loops for speed.
  1 个评论
Oleg Komarov
Oleg Komarov 2012-4-15
"Without loops for speed" is really not the right statement anymore.
Many times loops are much faster is correctly set up.

请先登录,再进行评论。

采纳的回答

Oleg Komarov
Oleg Komarov 2012-4-15

更多回答(1 个)

Jan
Jan 2012-4-15
B = (M(1:end-1, :) >= M(2:end, :));
  2 个评论
Jan
Jan 2012-4-15
It is worth to investigate the similarities and differences to Oleg's (faster) solution.
Aravin
Aravin 2012-4-18
Jan, Oleg worked on my small examples. I could find any dissimilarity. If you have in your mind then please share.
Thanks for your help too.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by