MATLAB: Conditional Statements Between Two Arrays arrayif statement I am trying to compare each value between two large arrays then store true values as another array. What do I type? Best Answer a = 1:100;b = 1:2:100;c = ismember(a,b); % index of values of array a inside of array bd = a(c); % the values inside of a that are in b Related SolutionsMATLAB: Conditional statements on array. This looks like a job for cummax, along with a logical array (ch 12 MATLAB Onramp).Input = [0,0,0,0,0,5,6,7,25,68,0,0,0,0,0,36,221,78,14,16,96,75,0,0];B = cummax(Input);Output = B >= 100Output = 1x24 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 MATLAB: If statement with an greater than comparison It's pretty much what you've written:if A > B C = A;else C = B;end Related QuestionConditional statement with ||Assigning New Matrix Elements Based On Comparing 2 MatricesConditional if statement solutionComparing single element of one array with values of another arrayUsing conditional IF statement
Best Answer