フィルターのクリア

dlmread not working as expected...

3 ビュー (過去 30 日間)
Benson
Benson 2013 年 6 月 12 日
%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!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 12 日
編集済み: Azzi Abdelmalek 2013 年 6 月 12 日
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 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by