Why does the importdata function read in my file data incorrectly when reading data from a .mp file
1 回表示 (過去 30 日間)
古いコメントを表示
When I run the function MyData = importdata(filename); I am getting an issue with how the data is reading in.
In the created MyData variable I should now have 2 new fields textdata and data which should be defined by the ' ' delimiter and their values/text.
Below is a breakdown of my code + data and the outputs I'm getting if anyone can help or has had this type of issue before?
Here's an example of what the data from the .mp file looks like as a text file
$Female = 0
$Adult = 1
$Height = 1885
$BodyMass = 71.8
$SamplingRate = 250
Instead of breaking the data up into the appropriate sections based on the ' ' delimiter it does this for textdata
'$Female ='
'$Adult = 1'
'$Height = 1'
'$BodyMass ='
And this for data
0
NaN
885
71.8000000000000
0 件のコメント
採用された回答
Walter Roberson
2016 年 11 月 23 日
fid = fopen(filename, 'rt');
datacell = textscan( fid, '%s=%f' );
fclose(fid)
textdata = datacell{1};
data = datacell{2};
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!