Pulling certain data from a text file into Matlab.
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to pull the frequence and the angle data only from this .txt file.
I have attached a sample of the data.
0 件のコメント
回答 (1 件)
Mateus Banroc
2020 年 1 月 9 日
Hi BrieAnna,
Consider using fgetl function to read the lines of txt. And also use strsplit to split the string and get the individual values you want.
strsplit returns a cell array, so remember to transform the cell element in string (letters) or double (numbers).
Ex:
fid = fopen('mytxt.txt');
line = fgetl(fid); % line = '0.000, 0.000, 0.000, 9.000'
line = strsplit(line,', '); % line = {'0.000'} {'0.000'} {'0.000'} {'9.000'}
freq = str2num(line{4}); % freq = 9.000
fclose(fid)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import and Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!