Borrar filtros
Borrar filtros

To delete the empty fields in the dataset

2 visualizaciones (últimos 30 días)
Khaing Zin Htwe
Khaing Zin Htwe el 27 de Abr. de 2016
Comentada: Elias Gule el 9 de Mayo de 2016
Dear all, Could you please help me that I faced the difficulty to do the data set to be tidy up? I want to delete the empty fields in the data set. The data set(53x2 cell array) is below;
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[1x18 struct] [1x18 struct]
[1x18 struct] []
[] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[1x18 struct] []
[] []
[1x18 struct] [1x18 struct]
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 27 de Abr. de 2016
Is it a cell array or what? What is its size? do you mean to delete the entire row?
Khaing Zin Htwe
Khaing Zin Htwe el 27 de Abr. de 2016
this data set is 53x2 Cell Array,sir. I want to delete only these empty fields showed below:

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 27 de Abr. de 2016
V={5 [];4 6;[] 8;7 8;[] []}
idx=cellfun(@isempty,V)
V(any(idx,2),:)=[]
  3 comentarios
Khaing Zin Htwe
Khaing Zin Htwe el 9 de Mayo de 2016
Dear Azzi Abdelmalek , May i also know how to reduce the empty fields of array.I have the array [1 0 0 2 3 5 6 0 2 8 0].I want to delete these empty columns of this array.It is so easy for you,i think.Please help me,sir.
Azzi Abdelmalek
Azzi Abdelmalek el 9 de Mayo de 2016
Editada: Azzi Abdelmalek el 9 de Mayo de 2016
If there are empty element, that means you haven't to delete them, because they don't exist, unless you mean to delete the zero elements, in this case
array=[1 0 0 2 3 5 6 0 2 8 0]
out=nonzeros(array)'

Iniciar sesión para comentar.

Más respuestas (1)

Elias Gule
Elias Gule el 29 de Abr. de 2016
Now, try this
V = {1,2,[],[],23,16,'A',struct()}; % your cell array
V = V(~cellfun('isempty'),V);
  2 comentarios
Khaing Zin Htwe
Khaing Zin Htwe el 1 de Mayo de 2016
THanks sir.
Elias Gule
Elias Gule el 9 de Mayo de 2016
Plz replace
V = V(~cellfun('isempty'),V);
with
V = V(~cellfun('isempty',V));

Iniciar sesión para comentar.

Categorías

Más información sobre Structures 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!

Translated by