Create table from data

1 回表示 (過去 30 日間)
DavidL88
DavidL88 2021 年 1 月 12 日
コメント済み: Adam Danz 2021 年 1 月 13 日
Hi
I'm trying to extract some data (A1-4) and place it into a table. I get the error message "Error using vertcat - Dimensions of arrays being concatenated are not consistent." Can you advise what this is and how I can fix it?
The overall script the below code is from is more complex. The purpose of it is to extract data from a large number of statistical tests from multiple subjects and place the data in one table. When I run the script on one file (one subject and one test) I get the same error message. When I remove T1-4 from within the [ ] below and run it on one file then the table comes out fine. However, if I do that with all my files in a loop then the table comes out empty. For the one file I tested it on; A1-3 are 1x94 double and A4 is 1x94 cell.
T1 = [T1; A1]';
T2 = [T2; A2]';
T3 = [T3; A3]';
T4 = [T4; A4]';
T = table(T4, T1, T2, T3)
  13 件のコメント
DavidL88
DavidL88 2021 年 1 月 13 日
Thank you!
I wanted to accept your answer but can't see the option next to your comment?
Adam Danz
Adam Danz 2021 年 1 月 13 日
I copied the comment I think you're referencing to the answers section. Thanks for keeping the forum tidy!

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

採用された回答

Adam Danz
Adam Danz 2021 年 1 月 13 日
Summary of comments under the question,
Instead of initializing T as an empty cell, use an empty table.
T = table();
A1 = array2table(rand(3,3));
C = [T,A1]
C = 3x3 table
Var1 Var2 Var3 _______ _______ _______ 0.73391 0.42024 0.11362 0.81381 0.81976 0.94401 0.23762 0.68696 0.64335

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by