MATLAB: Bsxfun with AND condition and condition 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); Best Answer 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. Related SolutionsMATLAB: How to write Continue Long Statements on Multiple Lines Use repmat to avoid manually typing all 160 of those ‘%q’ repeats! Try this: formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]']; MATLAB: Dear friends, the long matlab command that I have written is error. I want to be spelled the same way but without error. Do it like the second example on this documentation page about continuing long statements on multiple lines. Related QuestionError using bsxfun?How to write Continue Long Statements on Multiple LinesSimple use of bsxfunMatrix operation without for-loopParfor error with bsxfun
Best Answer