How to create a new array with variables that did not meet the required parameters.
1 view (last 30 days)
Show older comments
My code is written so that it displays whether or not a certain batch has failed or not. However, I would like it to seperate the failed batches into a new (vertical) array and the good batches into a second (vertical) array, without fprinting whether or not it is a good batch or a failed batch. I need this new array in order to calculate the percent that failed.
for idx = 1:numel(arrayDwellTime);
element = arrayDwellTime(idx);
....;
end
count=1;
while count<length(arrayDwellTime);
DwellTime=arrayDwellTime(count,1);
count=count+1;
for k = 1:length(DwellTime);
fprintf('%i',DwellTime(k));
end
if DwellTime>=2 && DwellTime<=2.5 fprintf(' batch good \n')
else fprintf(' batch failed \n')
end
end
0 Comments
Answers (1)
darova
on 6 Oct 2019
Try
cond = DwellTime>=2 & DwellTime<=2.5;
[cond.*DwellTime ~cond.*DwellTime]
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!