MATLAB: Ans representation in decimal

ans in decimal

Good day.
Houp, I could get some hint on how to change the formatting of answers in a live script.
syms ht_inpt(mass, dlt_t, spc_ht_mtr)
ht_inpt(mass, dlt_t, spc_ht_mtr)=mass*dlt_t*spc_ht_mtr;
mass=6*u.kg;
mass_t1=(20+273)*u.K;
mass_t2=(100+273)*u.K;
spc_ht_mtr=4190*u.J/(u.kg*u.K);
dlt_t=mass_t2-mass_t1;
ht_inpt=ht_inpt(mass, dlt_t, spc_ht_mtr)
ht_inpt=2011200 J
ht_inpt = unitConvert(ht_inpt,u.kJ)
ht_inpt=10056/5 kJ
­How a document can be edited that all answers in it would be expressed with decimals?

Best Answer

FYI the code you shared generates the following error
Unable to resolve the name u.kg.
Add the following to fix that:
u = symunit;
I suspect the issue is that you are using symbolic. If you want to keep your answer symbolic, see this page (specifically, sympref('FloatingPointOutput',true);). If you want to convert it to numbers, use the double function.
Related Question