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!

 채택된 답변

Michael Haderlein
Michael Haderlein 2014년 8월 5일
편집: Michael Haderlein 2014년 8월 5일

0 개 추천

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

Thor
Thor 2014년 8월 5일
Great! thanks had never thought of using hull functions before
John D'Errico
John D'Errico 2014년 8월 5일
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
Michael Haderlein 2014년 8월 5일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

질문:

2014년 8월 5일

댓글:

2014년 8월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by