how to find an empty row in a table
    18 ビュー (過去 30 日間)
  
       古いコメントを表示
    
Hello, I'm trying to get rid of a certain row in a single column table that only has  a []. for example if I have a table.
            column 1
row1   |    'hey'   |
row2   |    'hey'   |
row3   |      [ ]     |
how can I get it to be 
            column 1   
row1   |    'hey'   |
row2   |    'hey'   |
I have a code that works but for larger tables it's extreemely slow.
yee = "original table";
yee1=table;
for n=1:numel(yee)
    if isa(yee{n},'char')
        bus=yee(n);
        yee1 = [yee1 ; bus];
    end
end
I feel like there's a lot more efficient ways to do this. Thanks for any help!
0 件のコメント
採用された回答
  Matt J
      
      
 2019 年 6 月 21 日
        
      編集済み: Matt J
      
      
 2019 年 6 月 21 日
  
      loc=cellfun('isempty', yourTable{:,'column1'} );
yourTable(loc,:)=[]
3 件のコメント
  Gabor
      
 2021 年 3 月 4 日
				For me it works if I convert the table to cell and I use the column number in the script:
yourTable2=table2cell(yourTable);
loc=cellfun('isempty', yourTable2{:,1} );
I hope it helps someone.
その他の回答 (1 件)
  Guillaume
      
      
 2019 年 6 月 21 日
        Even simpler, and probably faster, use the table tools (rather than cell array tools):
yourtable = rmmissing(yourtable)
1 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Tables についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


