dlmread not working as expected...
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
%This is my file (and also the expected output):
%0 0.334 12:54:00 9.3 -54
%0.22 0.592 13:06:00 5.2 -22
%...........................
M = dlmread(filename.txt);
disp(M);
My current code does not display the expected output.
I have also tried M = dlmread(filename.txt,' '); to specify space delimiters but it returns an error "Mismatch between file and format string. Trouble reading number from file (row 1, field 4) ==> :54:0"
I believe all my values are numeric, since disp(class(12:54:00)) and disp(class(13:06:00)) returns double. Not sure why dlmread doesn't work :(
Any help is appreciated. Thanks!
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 12 Giu 2013
Modificato: Azzi Abdelmalek
il 12 Giu 2013
12:54:00 is double because it represent an empty array starting from 12 to 00 with step=54. type
a=12:54:00
I suggest that you use textscan or fgetl to read your data
fid=fopen('YourFileName.txt')
a=textscan(fid,'%f%f%s%f%f')
fclose(fid)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Text Data Preparation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!