フィルターのクリア

Adding new columns in a Table?

17 ビュー (過去 30 日間)
wesleynotwise
wesleynotwise 2017 年 6 月 9 日
コメント済み: wesleynotwise 2017 年 6 月 20 日
I think this should be quite simple, but somehow I couldn't find the solution online.
I have two Tables, eg: Table1 and Table2. How to add let say two columns from Table 2 to Table 1.
I have tried this, but it does not work as the two input must be in a table form.
T1 = [T1 T2.ColumnA T2.ColumnB]
  2 件のコメント
Peter Perkins
Peter Perkins 2017 年 6 月 19 日
The problem with this is that you're trying to concatenate a table with two doubles (I'm guessing). As Walter shows, you need to concatenate tables.
wesleynotwise
wesleynotwise 2017 年 6 月 20 日
Hi Peter. Yes, you are right, the columns are doubles. Walter's answer works :)

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

採用された回答

Walter Roberson
Walter Roberson 2017 年 6 月 10 日
T1 = [T1, T2(:,{'ColumnA', 'ColumnB'})]
Note: this is only permitted if T1 does not already have variables with the same name.
  1 件のコメント
wesleynotwise
wesleynotwise 2017 年 6 月 15 日
Sorry for my late response to your answer. The code works brilliantly. Thank you.

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

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