strfind for datasets

Search and find entries in a Matlab dataset (in a specified string variable)


Updated 10 Jul 2009

View License

function ind=datasetStrFind(dset,str,vars)

like strfind.m but applies on datasets instead of cell arrays.

The "dataset" type is a matlab type which allows to store data in a similar
way than database tables. Database operations such as join can by applied
(see the function join). However I did not find a function to do a simple
field search on a dataset.

This function allows to look for a substring (str) within observations of
a variable (vars) of a dataset dset. vars can be the variable name or the
column number to search in the dataset.

% % %

names = {'John'; 'Henri';'Enrico'};
ages = [26; 18; 35];
d1 = dataset({names, 'Name'}, {ages, 'Age'})


will return

d1 =

Name Age
'John' 26
'Henri' 18
'Enrico' 35

ans =


Cite As

Arnaud Amzallag (2023). strfind for datasets (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Data Type Conversion in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes