Loading in a table that has multiple values in a single cell seperated by a comma
3 ビュー (過去 30 日間)
古いコメントを表示
Does matlab have an issue when you load in data from a csv file and multiple cells in your file contain more than one value which are seperated by a comma? I am trying to match to columns together from two different csv files that have the same data type but I am getting the issue of "
Error using tabular/ismember
A and B must contain the same variables.'
Is this because some of my cells in one of my csv contain multiple values and matlab is not able to recognize each one of them?
0 件のコメント
回答 (1 件)
Walter Roberson
2023 年 10 月 17 日
You are trying to use ismember() to compare two tables directly. ismember() only permits that if all of the same variables occur in each table
2 件のコメント
Walter Roberson
2023 年 10 月 26 日
編集済み: Walter Roberson
2023 年 10 月 26 日
Do not ismember entire tables -- select variables from the table.
filename1 = 'example1.xlsx';
filename2 = 'example2.xlsx';
T1 = readtable(filename1, 'VariableNamingRule', 'preserve');
T2 = readtable(filename2, 'VariableNamingRule', 'preserve');
[found, idx] = ismember(T2.('last name'), T1.('last name'));
T1.('first name')(idx(found))
innerjoin(T1, T2)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!