필터 지우기
필터 지우기

bsxfun with AND condition

조회 수: 2 (최근 30일)
AA
AA 2016년 11월 15일
댓글: James Tursa 2017년 2월 4일
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에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by