Borrar filtros
Borrar filtros

how to delete field in struct in loop?

2 visualizaciones (últimos 30 días)
Sagar Dhage
Sagar Dhage el 11 de Sept. de 2014
Respondida: Andrei Bobrov el 11 de Sept. de 2014
In have struct A having fields A1(2x1), A2(2x1), A3(12x1) ....A100(23x1). I want to delete fields whose size is (2x1). how to delete it

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 11 de Sept. de 2014
n1 = fieldnames(A);
Aout = rmfield(A,n1(cellfun(@numel,struct2cell(A)) == 2));

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by