Editing Arrays of Matlab Structures

2 ビュー (過去 30 日間)
Paul
Paul 2014 年 6 月 24 日
コメント済み: dpb 2014 年 6 月 24 日
I'm trying to understand how to delete a vector of a structure.
For example if i create the following structure with this code ....
for i=1:10
S(1,i).P1=i;
S(1,i).P2=i;
S(1,i).P3=i;
S(1,i).P4=i;
S(1,i).P5=i;
S(1,i).P6=i;
S(1,i).P7=i;
end
How would I edit this structure so I remove all the parameters of S(1,5) and turn the structure to 1x9 instaed of 1x10
Thanks
Paul
  3 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 6 月 24 日
If you want to remove the fifth element of the structure, then why not try S([5]) = []?
dpb
dpb 2014 年 6 月 24 日
I thought I had tried it and it didn't actually remove the element from the array but on second attempt I see it does...not sure now what I messed up first go-'round.

サインインしてコメントする。

採用された回答

A Jenkins
A Jenkins 2014 年 6 月 24 日

その他の回答 (0 件)

カテゴリ

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