MATLAB: Display a variable and its units display I know how to use the display(X) function to display a variable I have solved for. So, if my X = 25, and I need it to display 25 ft/lb, how would I do this? Best Answer Units are now in MATLAB if you have Symbolic Math Toolbox. Try this, and see the tutorial: https://www.mathworks.com/help/symbolic/units-of-measurement-tutorial.html:>> u = symunit; >> x = 2*u.meter x = 2*[m]>> x = rewrite(x,u.ft) x = (2500/381)*[ft]>> double(separateUnits(x)) ans = 6.5617See the tutorial: https://www.mathworks.com/help/symbolic/units-of-measurement-tutorial.html Related SolutionsMATLAB: How to set a unit to variable Units are now in MATLAB if you have Symbolic Math Toolbox. Try:>> u = symunit; >> x = 2*u.meter x = 2*[m]>> x = rewrite(x,u.ft) x = (2500/381)*[ft]>> double(separateUnits(x)) ans = 6.5617See the tutorial: https://www.mathworks.com/help/symbolic/units-of-measurement-tutorial.html MATLAB: How to use MATLAB units Starting R2017a, units are available in MATLAB via Symbolic Math Toolbox. See:https://www.mathworks.com/help/symbolic/units-of-measurement-tutorial.htmlKaran. (Symbolic doc)[SL: fixed typo.] Related QuestionHow to add units to a number and differentiate between different inputsWrite a function to ask for given number and report whether they are between 10 and 100 or notFplot differentiated symbolic equation
Best Answer