Rowfilter option in datastore to search for specific pattern in strings

6 次查看(过去 30 天)
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-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 CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by