フィルターのクリア

extract field from a structure problem

2 ビュー (過去 30 日間)
Yu Li
Yu Li 2018 年 11 月 15 日
編集済み: Stephen23 2018 年 11 月 15 日
Hi:
I need to extract the field 'P' from a structure, to form a new structure with all the value of P. but I the answer in link below:
does not work, it only keeps the last one of the structure.
my command is tmp=DP1(:).P
Thanks!
Yu
  1 件のコメント
Stephen23
Stephen23 2018 年 11 月 15 日
編集済み: Stephen23 2018 年 11 月 15 日
@Yu Li: your code is like this:
tmp = DP1(:).P
whereas the code in the thread you linked to is like this:
tmp = [DP1(:).P]
Do you notice the difference?

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

採用された回答

Bruno Luong
Bruno Luong 2018 年 11 月 15 日
depending on the content, if scalar
tmp=[DP1.P]
or if not
tmp={DP1.P}
  1 件のコメント
Yu Li
Yu Li 2018 年 11 月 15 日
Thank you, your answer works.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by