Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.63 KB File ID: #24690
image thumbnail

strfind for datasets

by Arnaud Amzallag

 

10 Jul 2009

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

| Watch this File

File Information
Description

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.

% % %

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

datasetStrFind(d1,'ri',1)

will return

d1 =

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

ans =

     2
     3

MATLAB release MATLAB 7.4 (R2007a)
Other requirements The dataset type is available only with the Statistics toolbox, so only people working with this toolbox may need this function.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
strfind Arnaud Amzallag 13 Jul 2009 10:25:54
find Arnaud Amzallag 13 Jul 2009 10:25:54
search Arnaud Amzallag 13 Jul 2009 10:25:54
statistics Arnaud Amzallag 13 Jul 2009 10:25:54
dataset Arnaud Amzallag 13 Jul 2009 10:25:54

Contact us at files@mathworks.com