Changing 'precision' through startup ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Thor
el 5 de Ag. de 2014
Comentada: Michael Haderlein
el 5 de Ag. de 2014
Simple question, yet i havent found an answer: Is it possible to set the precission used for output (eg. using dlmwrite) in the startup.m file so i dont have to define it every time i use dlmwrite ?
Thanks!
0 comentarios
Respuesta aceptada
Michael Haderlein
el 5 de Ag. de 2014
Editada: Michael Haderlein
el 5 de Ag. de 2014
When you open the dlmwrite function, you will find that the standard value for precn is always 5 (variable precn in subfunction parseinput). Either just set the precision every time or create a "hull function" which passes all inputs further on to dlmwrite and adds the precision as additional parameter:
function dlmwrite2(varargin)
dlmwrite(varargin{:}, 'precision',2);
3 comentarios
John D'Errico
el 5 de Ag. de 2014
Be careful. It is NEVER a good idea to edit supplied MATLAB functions, as it is too easy to accidentally edit the code, then not realize you did something and even save the code without thinking. You will create bugs.
So rather than opening code using edit, use the type command to dump it to the command line. Just as easy, and much safer.
Michael Haderlein
el 5 de Ag. de 2014
Dear John,
thanks for your comment, I wasn't aware of the possibility to use the type function. Of course I agree with you to not edit supplied functions.
Best regards,
Michael
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!