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

2 vues (au cours des 30 derniers jours)
Matlab_Student
Matlab_Student le 24 Avr 2016
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!

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 24 Avr 2016
Modifié(e) : Azzi Abdelmalek le 24 Avr 2016
a=fscanf(fid,'%f',1)
sprintf('%0.6f',a)
Or use
format long

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by