How to search a table inside a cell

6 ビュー (過去 30 日間)
Jason Burke
Jason Burke 2021 年 4 月 8 日
回答済み: Tejas 2025 年 2 月 27 日
I have been given a workspace that has a cell variable that is 1x10 inside each cell is a table that is 100x16. Each column in each table has the same var names (time, rpm, temp, p1, p2, etc...).
I want to search the table in data(1,1) to find the first time what the temp is 300, but cannot figure out how.
  3 件のコメント
Jason Burke
Jason Burke 2021 年 4 月 8 日
I cannot find the syntax to access the table from the cell. The table that I want is at a(1,1) but when I try to look at the table I cannot figure that out.
Adam Danz
Adam Danz 2021 年 4 月 8 日
Access the cell using curly brackets.
Access a column variable in a table using dot-notation.
C{i}.var

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

回答 (1 件)

Tejas
Tejas 2025 年 2 月 27 日
Hello Jason,
To determine the time value for a specific temperature, consider these steps:
  • Begin by accessing the initial table located in the cell array.
firstTable = data{1,1};
index = find(firstTable.temp == 300, 1, 'first');
  • Retrieve the time value at the identified index using the provided syntax.
timeAtTemp300 = firstTable.time(index);

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by