필터 지우기
필터 지우기

(Matlab 2013) Specify Number of Decimal Digits When Reading In a Number

조회 수: 2 (최근 30일)
Matlab_Student
Matlab_Student 2016년 4월 24일
편집: Azzi Abdelmalek 2016년 4월 24일
x(nodeID)=fscanf(fid,'%f',1);
This is the argument that I have to read in a number of 6 decimal digits (1.123456) but the program reads only up to 4 decimal digits (which is what I think the default setting?). I tried using
'%.6f'
but it didn't work. It only gives me an error. Any help will be appreciated!

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 24일
편집: Azzi Abdelmalek 2016년 4월 24일
a=fscanf(fid,'%f',1)
sprintf('%0.6f',a)
Or use
format long

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by