I am using dlmwrite to create two columns in a text file. The first column contains numbers (a=[1:1:100]) and then second column contains zeros (b=zeros(100,1). I then concatenated them and replaced some of the zeros with numbers. When written to a file I need the zeros to display as 0.0 instead of 0. I currently have it written to a .txt file.

 채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 4일

0 개 추천

Use 'precision', '%.1f' for dlmwrite()

댓글 수: 2

Anna Cole
Anna Cole 2018년 6월 4일
Can I have a different precision for different columns in dlmwrite?
Walter Roberson
Walter Roberson 2018년 6월 4일
Sorry, that is not possible with dlmwrite(). You should fopen/fprintf/fclose for that.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2018년 6월 4일

댓글:

2018년 6월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by