Perform an adjustable search
    4 views (last 30 days)
  
       Show older comments
    
    Cristian Martin
 on 14 Jun 2022
  
    
    
    
    
    Commented: Cristian Martin
 on 15 Jun 2022
            Hi,
I created a search box for finding in a certain column of a table different values. All good till now, that's easy, but i also want to create a popup menu where user can adust the search by selecting percentage (like 1%, 2%, 3% an so on). I dont know exactly how to explain in english, sorry.
Example: If the user  want to search the number 15 and all the numbers before and after 15 with +- 2 (or 200%) , the result will be al  rows containing 13, 14, 15, 16 and  17
Thanks !
3 Comments
Accepted Answer
  ILoveMATLAB
      
 on 14 Jun 2022
        
      Edited: ILoveMATLAB
      
 on 14 Jun 2022
  
      All you have to do is use logical indexing. I assume you already do this to find the whole numbers
%Assume 13 and 17 are your limits, and tbl is your original table. Also assume col1 contains numbers. 
TF = (tbl.col1>= 13) & (tbl.co1<=17) 
filteredTbl = tbl(TF,:)
%If you replace 13 and 17  with variables your search becomes adjustable.
More Answers (0)
See Also
Categories
				Find more on Entering Commands 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!

