unique across tables within table

4 ビュー (過去 30 日間)
Paolo Mazzoleni
Paolo Mazzoleni 2024 年 8 月 15 日
コメント済み: Paolo Mazzoleni 2024 年 8 月 29 日
Hello
I've got what in the screenshots below, so RawFileIndex is a table that contains Paramaters that is another table (or a 1x1 cell containing a table? I'm a bit confused...)
I want to know all the parameter ID accross all the files, something like unique(RawFileIndex.Parameters{:,1}.ID) but this is clearly not the right syntax... how do I do it?
thanks

採用された回答

Stephen23
Stephen23 2024 年 8 月 15 日
U = unique(vertcat(RawFileIndex.Parameters{:}).ID)
  5 件のコメント
Stephen23
Stephen23 2024 年 8 月 29 日
編集済み: Stephen23 2024 年 8 月 29 日
"was it the right choice to use a table for it?"
If a table holds the information you require in a way that makes accessing it efficient and easy to understand for you, then it was a reasonable choice.
"whould you have structered it any differently?"
I probably would have used a structure array. In general use the simplest data structure that can reasonably contain the data.
"is it possible to have a table directly within another table or does it alway have to be a table in a cell within a table?"
Tables must be in a cell array.
Every table column actually consists of one array, which therefore must have exactly as many rows as the table has. However, in general tables have arbitrary number of rows, so in general the number of rows of nested tables would not sum to the number of rows of the parent table. Therefore each nested table is instead placed in a cell array (which does have exactly the same number of rows as the parent table). Exactly the same argument applies to all other arrays where non-scalar rows must be stored in one table row.
Paolo Mazzoleni
Paolo Mazzoleni 2024 年 8 月 29 日
thanks

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by