Remove element from cell array completely

2 visualizaciones (últimos 30 días)
Muaaman
Muaaman el 18 de Dic. de 2014
Comentada: Stephen23 el 19 de Dic. de 2014
I have a cell array with the following information:
>> handles.guideGUI
ans =
Columns 1 through 8
@arq_02 @arq_03 @arq_04 @arq_05 @arq_06 @arq_07 @arq_08 @arq_09
Columns 9 through 14
@arq_10 @arq_11 @arq_12 @arq_13 @arq_14 []
It is still saying that that this is a 1x14 cell, and therefore the empty brackets [] still exist. How do I get rid of it completely so that it becomes 1x13 cell?
i.e. I want it to appear as:
ans =
Columns 1 through 8
@arq_02 @arq_03 @arq_04 @arq_05 @arq_06 @arq_07 @arq_08 @arq_09
Columns 9 through 13
@arq_10 @arq_11 @arq_12 @arq_13 @arq_14

Respuesta aceptada

Thorsten
Thorsten el 18 de Dic. de 2014
Editada: Thorsten el 18 de Dic. de 2014
handles.guideGUI(15) = [];
  4 comentarios
Muaaman
Muaaman el 19 de Dic. de 2014
Ohhh I see. My apologies Thorsten I see the difference. Thank you!
Stephen23
Stephen23 el 19 de Dic. de 2014
It is very important to note the difference between () and {} indexing with cell arrays. In a nut-shell:
  • () refers to the cell itself, whereas
  • {} refers to the data within the cell.

Iniciar sesión para comentar.

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 18 de Dic. de 2014
handles.guideGUI(cellfun('isempty',handles.guideGUI))=[]
  1 comentario
Muaaman
Muaaman el 19 de Dic. de 2014
Thank you Azzi for this alternative answer.

Iniciar sesión para comentar.

Categorías

Más información sobre Resizing and Reshaping Matrices 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