MATLAB: How to Shorten This Logical Expression logical expression What is the best way to rewrite A in the shortest way? B = 1:14; A = B == 1 | B == 2 | B == 3 | B == 7 ; Best Answer A = ismember(B,[1 2 3 7]) Related SolutionsMATLAB: Sum two arrays using logical indices c=a.*(a_logical)+b.*(b_logical)c = 1 3 4 MATLAB: Solving non-linear equations – not enough input arguments The way you’ve written your code, I believe you want the fsolve function instead.Try this:f = fsolve(@ts1, x0, options) Related QuestionHow to switch the value of a boolean.Normalizing a symbolic expressionHow to reorder cell array columns based on the order of a vector matrix, while keeping rows intact in MatlabIf-expression only runs the first expressionDetermine the loop which satisfies the particular condition.How to interpret this expression
Best Answer