bsxfun with AND condition

1 次查看(过去 30 天)
How can I use a code to see if compare1<q{x,y}<compare2
Basically the lt/gt function combined with an and function?
bsxfun(@lt,q{x,y},compare2 & q{x,y},compare1);

采纳的回答

James Tursa
James Tursa 2016-11-15
编辑:James Tursa 2016-11-15
Assuming q{x,y} and compare# are different sizes and need bsxfun, just & the two separate calculations:
result = bsxfun(@lt,compare1,q{x,y}) & bsxfun(@lt,q{x,y},compare2);
For R2016b you would not need bsxfun for this at all but could code the < operations directly.

更多回答(1 个)

AA
AA 2017-2-3
no it doesnt work. it gives me one set that is less than compare 2 and another set that is less than compare 1. after that it combines these two sets.
I need compare1<q{x,y}<compare2
  1 个评论
James Tursa
James Tursa 2017-2-4
Please post your code so we know what "... doesn't work ..." means to you.

请先登录,再进行评论。

类别

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