strfind for datasets

版本 1.0.0.0 (1.6 KB) 作者: Arnaud Amzallag
Search and find entries in a Matlab dataset (in a specified string variable)
690.0 次下载
更新时间 2009/7/10

查看许可证

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

引用格式

Arnaud Amzallag (2024). strfind for datasets (https://www.mathworks.com/matlabcentral/fileexchange/24690-strfind-for-datasets), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0