check the index of cell which were removed
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    ha ha
      
 el 6 de Mzo. de 2018
  
Let's say:
A : 4x1 cell class
A={cell_1   ;cell_2   ;    cell_3    ;cell_4 }
A={   []    ;[999,222];[444,222,2000];  []   };
B is index matrix of cell A:
B=[1;2;3;4] %index matrix of cell A
If I wanna remove the "empty cell" out of A, I can use this code:
A_remove=A(~cellfun('isempty',A));
And with respect to A, the index matrix B will be:
B_remove=[2;3]; %remove the index of "empty cell"
How can to find "B_remove" matrix from A &B ??
0 comentarios
Respuesta aceptada
  Stephen23
      
      
 el 6 de Mzo. de 2018
        
      Editada: Stephen23
      
      
 el 6 de Mzo. de 2018
  
      Using logical indices:
B_remove = cellfun('isempty',A)
B_keep = ~B_remove
If you really want the subscript indices then use find.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Matrix Indexing 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!

