Function that returns value after decimal point?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Is there a function that returns the value after the decimal?
EX:
a = 2.876
function(a) = 0.876
Thank You
0 comentarios
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 4 de Oct. de 2012
Editada: Azzi Abdelmalek
el 4 de Oct. de 2012
out=a-fix(a)
%or
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])
2 comentarios
Azzi Abdelmalek
el 4 de Oct. de 2012
Editada: Azzi Abdelmalek
el 4 de Oct. de 2012
a=1
a-fix(a)=0
and
A=num2str(a);
out=str2num(['0' A(strfind(A,'.'):end)])=0
Ver también
Categorías
Más información sobre Operators and Elementary Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!