フィルターのクリア

find commas in a cell

12 ビュー (過去 30 日間)
ludvikjahn
ludvikjahn 2015 年 3 月 13 日
回答済み: Audrey 2015 年 3 月 13 日
good morning, I just wonder why
if I run
strrep(A,',','.')
( (where A is a cll array), it works
but I can't run the command
find(A,',')
(I wanted to know how many commas there are in order t know if it is possible to replace them in a short time). And I wan to find a method to find commas in my cell array! Thanks

回答 (1 件)

Audrey
Audrey 2015 年 3 月 13 日
You can use strfind() to find a pattern within text. So, for example:
A={'asdf,asdf','asdf,asdf,asdf','asdf'}; strfind(A,',')
ans =
[5] [1x2 double] []
I'm sure you can do it with regular expressions as well, but I am not familiar with that. It looks to me like strrep() already does what you want (replace commas in a short time).
If you want to apply a function to a cell array that does not accept cell arrays as input, you can use cellfun() to apply a function to each array in a cell individually.

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by