image thumbnail


version (2.03 KB) by Per-Anders Ekstrom
Symbolic variable substitution in expression.


Updated 01 Feb 2007

View License

SUBVAR(S,OLD,NEW) replaces OLD with NEW in the expression S.
OLD is a string or cell of strings representing variable names to be substituted by NEW in the expression S.

Only variables defined as using SYMVAR are substituted. That is in expressions like 'f(1)', SUBVAR interprets the symbol 'f' as a function call, not as an index into a symbolic variable.

returns 'sin(u(1)*exp(2.3*-u(2)))+u(1)'

Cite As

Per-Anders Ekstrom (2022). subvar (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!