Convert to int PROBLEM

Hey guys I have this code
p3=(less-5)/197632;
if p3>1
m=256;
less=less1-((3*n*m*p3)+(4*m*p3)+(4*p3)+1);
fprintf(fid, '%d \n', p3);
end
I want to print p3 but is in double, how I convert p3(double) to int. less is given by the user
Thank you very much

Respuestas (1)

Walter Roberson
Walter Roberson el 22 de Abr. de 2017

0 votos

fprintf(fid, '%d \n', floor(p3));

2 comentarios

Javier Lagunas
Javier Lagunas el 22 de Abr. de 2017
Thank you very much it really works, and did you now how to convert without printing
Walter Roberson
Walter Roberson el 22 de Abr. de 2017
p3 = floor(p3);

Iniciar sesión para comentar.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 22 de Abr. de 2017

Comentada:

el 22 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by