How to find unique values
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    cat cat
 el 18 de Feb. de 2016
  
    
    
    
    
    Editada: Star Strider
      
      
 el 18 de Feb. de 2016
            Hi! I have the cell array of strings 'a' (attached): it's composed by 65 rows and 9 columns. For every columns, I want to find the values repeated only one time. The final result must be a cell array of strings with 9 columns that contains these values:
Column1     Column2    Column3   Column4    Column5    Column6    Column7    Column8    Column9
   4           2          1         1          1          3          2          32         2
               3          3                    2                     3          1          4
                          4                    4                                2
                                                                                3
Can you help me? thanks
0 comentarios
Respuesta aceptada
  Star Strider
      
      
 el 18 de Feb. de 2016
        
      Editada: Star Strider
      
      
 el 18 de Feb. de 2016
  
      The ‘Uvals’ array should have the information you want:
D = load('cat cat matlab2.mat');
a = D.a;
non_empty = cellfun(@(x)~isempty(x), a);
[r,c] = find(non_empty);
for k1 = 1:max(c)
    idx = r(c == k1);
    vals = a(idx,k1);
    Uvals{k1} = unique(vals);                   % Unique Values
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Characters and Strings en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

