for loop to convert cells of column to string
    4 ビュー (過去 30 日間)
  
       古いコメントを表示
    
i have a data which is a column of cells (some string and some douple), i search for some words in it

i use this code
 for E=1:R            % from 1 : length of columns
   B=~cellfun('isempty',regexp(alldata(:,52),'BATTERY'))    % search for battrey and return 1 or 0
if (B(E) == 1)               % if value of array greater than or equal 1
    Defs(j)=E;              % save its postion (E,1)
        j=j+1;
else                     % save all arrays didn't have 'battery' separately
        not(k)=E;
        k=k+1;
end
end
but i get an error
All cells must be strings.
in line B=~cellfun('isempty',regexp(alldata(:,52),'BATTERY'))
how i can run a for loop to convert all cells into double?
i use this
 data= ' Nan ' 
data={};
data{ not( cellfun( @ischar, data ) ) } = '';
but i cant run a for loop... :(
採用された回答
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
