MATLAB Answers

Calculate the length of symbolic expression

5 views (last 30 days)
T S Singh
T S Singh on 18 Feb 2020
Commented: T S Singh on 19 Feb 2020
I am trying to caculate the total length of a symbolic expression.
syms x a b
I want to cacluale the length of 'df', in my case the answer should be nine (including operator).
I am using MATLAB 2015a.
Any help please.


Sign in to comment.

Accepted Answer

KSSV on 18 Feb 2020
S = char(df) ; % convert sym to string
idx = strfind(s,' ') ; % get empty spaces
S(idx) = [] ; % remove the mepty spaces
iwant = length(S)

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by