Round saved variables (not command line output) to 5 decimal places
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
K G
el 22 de Abr. de 2016
Comentada: Walter Roberson
el 23 de Abr. de 2016
I am trying to create a series starting at 0.00625 km, with a step of 0.00625 km i.e. the first three terms would be: 0.00625 0.0125 0.01875 .... I am creating this series using:
dx=0.00625;
xstart=0.00625;
xend=35;
vbx=(xstart:dx:xend);
However the variable vbx is only saving to 4 decimal place precision i.e. 0.0063 0.0125 0.0188 ...
I need the actual variable that is saved to have the correct precision - the output on the command line is not important.
Could someone tell me how to go about this?
round does not work unfortunately, I think that this is an error due to the class of the numbers?
0 comentarios
Respuesta aceptada
Stephen23
el 22 de Abr. de 2016
Editada: Stephen23
el 22 de Abr. de 2016
>> vbx(1:5) % default format == short
ans =
0.0063 0.0125 0.0188 0.0250 0.0313
>> format longg
>> vbx(1:5)
ans =
0.00625 0.0125 0.01875 0.025 0.03125
Note that if you are using save then its precision is controlled by an optional input argument, and not the command window format.
2 comentarios
Walter Roberson
el 23 de Abr. de 2016
There is a preference that controls the format used by the browser
Más respuestas (1)
Ver también
Categorías
Más información sobre Logical 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!