Effacer les filtres
Effacer les filtres

Rowfilter option in datastore to search for specific pattern in strings

18 vues (au cours des 30 derniers jours)
Surya Kandukuri
Surya Kandukuri le 24 Sep 2023
Commenté : Simon Sigl le 25 Oct 2023
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 commentaire
Simon Sigl
Simon Sigl le 25 Oct 2023
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?

Connectez-vous pour commenter.

Réponses (1)

Pratyush
Pratyush le 25 Sep 2023
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 commentaires
Surya Kandukuri
Surya Kandukuri le 25 Sep 2023
Thank you! I will try that.
Surya Kandukuri
Surya Kandukuri le 2 Oct 2023
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Large Files and Big Data dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by