b=regexprep(b,'^','.^','all'); doesn't works.
Show older comments
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?
Accepted Answer
More Answers (2)
Azzi Abdelmalek
on 8 Jul 2013
b=regexprep(b,'\^','.\^')
Jan
on 8 Jul 2013
STRREP is faster than REGEXPREP:
b = strrep(b, '^', '.^');
Categories
Find more on Code Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!