Rowfilter option in datastore to search for specific pattern in strings

6 ビュー (過去 30 日間)
Surya Kandukuri
Surya Kandukuri 2023 年 9 月 24 日
コメント済み: Simon Sigl 2023 年 10 月 25 日
I have a large parquest datastore with several files consisting several rows and four columns. One of these columns have strings of long names. I'd like to extract all of those names that contain a specific pattern, eg:'OS.V' . Normally, i use contains(df.column_C, 'OS.V'), to get the list. But within filter, this throws an error. Is there another way to approach this? Thanks
df.rowfilter = c; c = (df.column_C=="TUB1.OS.V"); %this gives that specific tag%
%but not this%
c = contains(df.column_C, 'OS.V'); % I'd like to extract "TUB1.OS.V", "M.TUB2.OS.V",...
  1 件のコメント
Simon Sigl
Simon Sigl 2023 年 10 月 25 日
Similar problem here. I would like to specify a filter condition based on a list/set:
aTable = (some tall array);
ids2Filter = ["id1", "id2"];
rf = rowfilter(aTable);
rf2 = rowfilter(ismember(rf.id, ids2Filter)) %ismember does not accept rowfilter
how can this be done?

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

回答 (1 件)

Pratyush
Pratyush 2023 年 9 月 25 日
Hi Surya,
I understand that you want to filter rows from your datastore which have a specific pattern for a given column.
Modify your code in the following manner to use contains:
checkPattern = @(str) contains(str, 'OS.V');
c = @(df) checkPattern(df.column_C);
  2 件のコメント
Surya Kandukuri
Surya Kandukuri 2023 年 9 月 25 日
Thank you! I will try that.
Surya Kandukuri
Surya Kandukuri 2023 年 10 月 2 日
Umm.. that doesnt seem to work either...
Error using reconstructAfterSettingImportOptions
Expected RowFilter to be one of these types:
matlab.io.RowFilter
Instead its type was function_handle.

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

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by