How to delete particular row from struct array?

Hi
I want to know is there any passible method to delete the entire data related to particular column value in struct array.

댓글 수: 2

Give an example
Minu
Minu 2013년 5월 9일
I have a struct array s1 =
1x518 struct array with fields: label,density,leftdist,rightdist,topdist,bottomdist,transitions,coltransitions,rowsum,columnsum,leftdiagonals,rightdiagonals,v0,chimg
i want do delete the whole data related to label=9 and chimg.how to solve this?

댓글을 달려면 로그인하십시오.

 채택된 답변

David Sanchez
David Sanchez 2013년 5월 9일

1 개 추천

Hi, I think you are looking for this:
s=rmfield(s,field)
example of use:
s.a=1;
s.b=2;
s.c=3;
>> s
s =
a: 1
b: 2
c: 3
s=rmfield(s,'a');
>> s
s =
b: 2
c: 3

댓글 수: 2

you can use it recursively in the struct array
Minu
Minu 2013년 5월 9일
how to delete the whole field for particular label?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 9일

4 개 추천

s1=struct('a',num2cell(1:10),'b',num2cell(11:20),'c',num2cell(21:30))
label=9
s1(label)=[]

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

태그

질문:

2013년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by