Extract rows from table fullfilling the condition of interval
    1 view (last 30 days)
  
       Show older comments
    
Problem with measured data from service software in log. I am able to read these log files 
data = readtable('wimodlr_rlt_2019-12-09_09-46-07_LoRa SF12_LoRa BW 1600')
and i need to extract the rows according to % of PER. But these numbers are in this format:
data =
  169×7 table
    No_      Port           HostTime          DnLnkTx    DnLnkRx     DnLnkPER       PeerRSSI           
    ___    ________    ___________________    _______    _______    ___________    ___________    
   136    {'COM4'}    2019-12-09 09:47:08      136        125      {'8.09 %' }    {'-65 dBm'}          
    137    {'COM4'}    2019-12-09 09:47:09      137        125      {'8.76 %' }    {'-65 dBm'}              
    138    {'COM4'}    2019-12-09 09:47:09      138        125      {'9.42 %' }    {'-65 dBm'}              
    139    {'COM4'}    2019-12-09 09:47:09      139        125      {'10.07 %'}    {'-65 dBm'}                 
    140    {'COM4'}    2019-12-09 09:47:10      140        125      {'10.71 %'}    {'-65 dBm'}                
    141    {'COM4'}    2019-12-09 09:47:10      141        125      {'11.35 %'}    {'-65 dBm'}               
I need to filter only rows which fullfill the requirement for example: DnLNkPER<10% and DnLNkPER>9% with conversion of strings to double.
0 Comments
Answers (1)
  Peng Li
      
 on 3 Apr 2020
        
      Edited: Peng Li
      
 on 3 Apr 2020
  
      You may want to convert that specific column to double format, and the conditional operation would become easier.
% a test
tbl.test = {'10%', '15.6%', '29.0%', '30%', '11%'}';
tbl = struct2table(tbl)
tbl =
  5×1 table
      test   
    _________
    {'10%'  }
    {'15.6%'}
    {'29.0%'}
    {'30%'  }
    {'11%'  }
% convert column to double
tbl.test = cellfun(@(x) str2double(x(1:end-1)) ./ 100, tbl.test)
tbl =
  5×1 table
    test 
    _____
      0.1
    0.156
     0.29
      0.3
     0.11
0 Comments
See Also
Categories
				Find more on Use COM Objects in MATLAB 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!
