フィルターのクリア

How do i export text file into matrix with 4 different data? Pls advice how should the code will be ?

2 ビュー (過去 30 日間)
Time (Seconds): 0.00 Ground Speed (km/h): 171.2898382 G Force Long (G): 0.27 G Force Lat (G): 0.1856280
Time (Seconds): 0.02 Ground Speed (km/h): 171.4937546 G Force Long (G): 0.27 G Force Lat (G): 0.1856280
Time (Seconds): 0.04 Ground Speed (km/h): 171.6976711 G Force Long (G): 0.27 G Force Lat (G): 0.1846300
Time (Seconds): 0.06 Ground Speed (km/h): 171.9015876 G Force Long (G): 0.27 G Force Lat (G): 0.1846300
Time (Seconds): 0.08 Ground Speed (km/h): 172.1055041 G Force Long (G): 0.27 G Force Lat (G): 0.1836320
Time (Seconds): 0.10 Ground Speed (km/h): 172.3094205 G Force Long (G): 0.27 G Force Lat (G): 0.1836320
Time (Seconds): 0.12 Ground Speed (km/h): 172.5133370 G Force Long (G): 0.26 G Force Lat (G): 0.1836320
Time (Seconds): 0.14 Ground Speed (km/h): 172.7172535 G Force Long (G): 0.26 G Force Lat (G): 0.1846300
Time (Seconds): 0.16 Ground Speed (km/h): 172.8192117 G Force Long (G): 0.25 G Force Lat (G): 0.1846300
Time (Seconds): 0.18 Ground Speed (km/h): 173.0231282 G Force Long (G): 0.25 G Force Lat (G): 0.1856280
  2 件のコメント
Jan
Jan 2015 年 5 月 4 日
編集済み: Jan 2015 年 5 月 4 日
This is not twitter, so please omit the # in the tags. The tags are a comma separated list of terms, which should help to find the topic of your question. Now this is found, if any other user has a problem concerning "#text #export #dlmread #data #dlmwrite #matrix #matrice", but this is very unlikely.
The question is not clear. What did you post here? In which form is it stored in your code? What is the wanted result?
Yeap Jia Wei
Yeap Jia Wei 2015 年 5 月 5 日
編集済み: Yeap Jia Wei 2015 年 5 月 5 日
Dear Simon, this is the attached text file. Pleases advice on how to export it to matlab as matrix as code. Ty!

サインインしてコメントする。

回答 (1 件)

Joseph Cheng
Joseph Cheng 2015 年 5 月 5 日
編集済み: Joseph Cheng 2015 年 5 月 5 日
To answer your question, it's as simple as reading the documentation on fprintf or dlmwrite
The text file can be read in with fscanf or fgetl , and then parsed out with regexp or strfind to be then written with fprintf or dlmwrite.
Example of using regexp to obtain number. **note does not detect the - sign
fileID = fopen('track.txt');
pat = '((\d+,)*\d+(\.\d*))'
while ~feof(fid)
line = fgetl(fileID);
n = regexp(line, pat, 'match')
end
fclose(fileID);

カテゴリ

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