フィルターのクリア

How to access elements of nested structures

3 ビュー (過去 30 日間)
Behrooz Daneshian
Behrooz Daneshian 2022 年 12 月 29 日
コメント済み: Behrooz Daneshian 2022 年 12 月 29 日
Hi all,
I have a nested structure. A 1*1 struct(data) contains a 1*1 struct(metadata) and a 245*1 struct(results). I want to access the column 'id' within a 245 *1 struct. Can anyone teach me how to do that? the nested structure is attached here.

採用された回答

Image Analyst
Image Analyst 2022 年 12 月 29 日
Try this:
s = load('data.mat')
s = struct with fields:
data: [1×1 struct]
id = {s.data.results.id}'
id = 245×1 cell array
{'GHCND:USC00310090'} {'GHCND:USC00310184'} {'GHCND:USC00310212'} {'GHCND:USC00310241'} {'GHCND:USC00310286'} {'GHCND:USC00310356'} {'GHCND:USC00310375'} {'GHCND:USC00310506'} {'GHCND:USC00310576'} {'GHCND:USC00310645'} {'GHCND:USC00310674'} {'GHCND:USC00310724'} {'GHCND:USC00310750'} {'GHCND:USC00310843'} {'GHCND:USC00310901'} {'GHCND:USC00310982'} {'GHCND:USC00311055'} {'GHCND:USC00311156'} {'GHCND:USC00311165'} {'GHCND:USC00311221'} {'GHCND:USC00311222'} {'GHCND:USC00311239'} {'GHCND:USC00311248'} {'GHCND:USC00311420'} {'GHCND:USC00311429'} {'GHCND:USC00311515'} {'GHCND:USC00311535'} {'GHCND:USC00311564'} {'GHCND:USC00311578'} {'GHCND:USC00311606'}
  1 件のコメント
Behrooz Daneshian
Behrooz Daneshian 2022 年 12 月 29 日
Thank you so much for your help.

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

その他の回答 (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