Write arrays with exact values from .txt files with scientific notation
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
teasy
am 12 Sep. 2020
Kommentiert: teasy
am 13 Sep. 2020
Hello together,
i read values from .txt files. The values are in scientific notation and have the form
0.7553396358543418E-01
0.7553483893557424E-01
.....
My suggestion for this:
folder = ['foldername'];
filename_t = fullfile(folder, sprintf('%dHz_t_LS_%d.txt', f_sim, LS));
fileID_t = fopen(filename_t, 'rt');
t_total = textscan(fileID_t, '%sf,'HeaderLines',0);
t_total = t_total{1};
But unfortunately it never gives the correct value. I only get values in the form 0.0750, which is much too low accuracy.
i have already experimented with %16.8f etc., but did not reach my goal
Many greetings
2 Kommentare
Stephen23
am 12 Sep. 2020
"My suggestion for this"
will not work because the syntax is not valid:
t_total = textscan(fileID_t, '%sf,'HeaderLines',0);
% ^ ^ ^
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!