Replacement text in 'regexprep' function is recognized as function and gives an error

16 ビュー (過去 30 日間)
Batuhan Cakir
Batuhan Cakir 2018 年 6 月 3 日
編集済み: per isakson 2018 年 12 月 17 日
In the script I'm using, matched text needs to be replaced with 'f_and($1,$2)'. Replacement text in 'regexprep' function gives this error:
Error using regexprep
Evaluation of 'f_and($1,$2)' failed:
Undefined function 'f_and' for input arguments of type 'char'.
Error in analysis>addGeneData (line 167)
g = regexprep(g,match_expr,replace_expr,'once');
Error in analysis>geneToReaction (line 114)
It doesn't make sense that text is recognized as function and gives an error. Code section that causes error is shown below:
match_expr = ['(',ApmB,')\s+and\s+(',ApmB,')'];
replace_expr = '${f_and($1,$2)}';
g = regexprep(g,match_expr,replace_expr,'once');
Glad if you help. Thanks...

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 6 月 3 日
If that was not what you wanted then you should not use the regexp ${} construct. Perhaps just
'f_and($1,$2)'

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by