b=regexpre​p(b,'^','.​^','all'); doesn't works.

I want to replace ,/,^ to .,./,.^
my code:
syms t;
a='t^3+t*t+t^2/t';
b=a;
b=regexprep(b,'*','.*','all');
b=regexprep(b,'/','./','all');
b=regexprep(b,'^','.^','all');
Result I want:
a=t^3+t*t+t^2/t
b=t.^3+t.*t+t.^2./t
Real result:
a=t^3+t*t+t^2/t
b=t^3+t.*t+t^2./t
I think " b=regexprep(b,'^','.^','all');" doesn't works.
How can I fix this problem?

 採用された回答

Andrei Bobrov
Andrei Bobrov 2013 年 7 月 8 日
編集済み: Andrei Bobrov 2013 年 7 月 8 日

0 投票

syms t;
a=t^3+t*t+t^2/t;
b = vectorize(a);

1 件のコメント

Jonghun
Jonghun 2013 年 7 月 8 日
Thank You!!!!!!!!!!

サインインしてコメントする。

その他の回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 8 日

0 投票

b=regexprep(b,'\^','.\^')
Jan
Jan 2013 年 7 月 8 日

0 投票

STRREP is faster than REGEXPREP:
b = strrep(b, '^', '.^');

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by