フィルターのクリア

How to delete particular row from struct array?

29 ビュー (過去 30 日間)
Minu
Minu 2013 年 5 月 9 日
Hi
I want to know is there any passible method to delete the entire data related to particular column value in struct array.
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 9 日
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 日
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 件のコメント
David Sanchez
David Sanchez 2013 年 5 月 9 日
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 日
s1=struct('a',num2cell(1:10),'b',num2cell(11:20),'c',num2cell(21:30))
label=9
s1(label)=[]

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by