- https://www.mathworks.com/help/matlab/ref/fscanf.html - Use this to read the lines. You will get a 1xn vector with each line.
- https://www.mathworks.com/help/matlab/ref/strsplit.html - Use this to split each string with ';' (semicolon) delimiter.
- https://www.mathworks.com/help/matlab/ref/table.html - create a table.
Tables and files in matlab
2 ビュー (過去 30 日間)
古いコメントを表示
I have a text file, and i need to convert it to table in matlab or convert it to excel format using matlab. How can i do this?
Here is the file, and here is what i want
0 件のコメント
採用された回答
Kaustav Bhattacharya
2019 年 7 月 8 日
0 件のコメント
その他の回答 (1 件)
Peter Perkins
2019 年 7 月 8 日
Does this not do what you want?
>> t = readtable('Um7V.txt','Delimiter',';','ReadVariableNames',false);
>> head(t)
ans =
8×16 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16
_________ ______________________ _____________________ ______________________ ____________________ _____________________ ______________________ _____________________ ______________________ _______________________ _____________________ _______________________ ______________________ ____________________ ______________________ ______________________
{' ' } {'ëÁÎ:270' } {'ëÁÎ:271' } {'ëÁÎ:272' } {'ëÁÎ:273' } {'ëÁÎ:274' } {'ëÁÎ:275' } {'ëÁÎ:276' } {'ëÁÎ:277' } {'ëÁÎ:278' } {'ëÁÎ:279' } {'ëÁÎ:280' } {'ëÁÎ:281' } {'ëÁÎ:282' } {'ëÁÎ:283' } {'ëÁÎ:284' }
{'Avg' } {'(35.5493,-3064.25)'} {'(2376.54,2653.69)'} {'(903.531,-2982.85)'} {'(274.229,2445.3)'} {'(317.775,3399.14)'} {'(2265.15,-1870.15)'} {'(2240.59,2103.29)'} {'(-35.5488,2835.25)'} {'(-729.356,-3062.23)'} {'(112.373,2936.43)'} {'(-1312.73,-2757.41)'} {'(-945.222,-3044.9)'} {'(1205.2,3347.85)'} {'(-1818.78,2952.82)'} {'(-1735.86,2088.94)'}
{'Ampl' } {'6.27601e+06' } {'7.2956e+06' } {'6.38298e+06' } {'5.03937e+06' } {'6.99179e+06' } {'6.01581e+06' } {'6.29375e+06' } {'5.80706e+06' } {'6.44687e+06' } {'6.01821e+06' } {'6.25448e+06' } {'6.52952e+06' } {'7.28714e+06' } {'7.10249e+06' } {'5.56245e+06' }
{'Phase'} {'-1.5592' } {'0.840438' } {'-1.27667' } {'1.45912' } {'1.47758' } {'-0.690168' } {'0.753801' } {'1.58333' } {'-1.80462' } {'1.53255' } {'-2.01512' } {'-1.87179' } {'1.22525' } {'2.12286' } {'2.26414' }
{'0' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' } {'(0, 0)' }
{'1' } {'(0, 1290)' } {'(0, -1055)' } {'(0, 1286)' } {'(0, -1042)' } {'(0, -1437)' } {'(0, 852)' } {'(0, -825)' } {'(0, -1205)' } {'(0, 1273)' } {'(0, -1245)' } {'(0, 1129)' } {'(0, 1263)' } {'(0, -1391)' } {'(0, -1305)' } {'(0, -927)' }
{'2' } {'(0, 396)' } {'(0, 1099)' } {'(0, 935)' } {'(0, -184)' } {'(0, -289)' } {'(0, 1613)' } {'(0, 1085)' } {'(0, -409)' } {'(0, -44)' } {'(0, -349)' } {'(0, -445)' } {'(0, -167)' } {'(0, 259)' } {'(0, -1519)' } {'(0, -1326)' }
{'3' } {'(-81, -3179)' } {'(1492, 3617)' } {'(427, -2772)' } {'(270, 2650)' } {'(322, 3628)' } {'(1265, -1120)' } {'(1390, 2993)' } {'(92, 2923)' } {'(-532, -3439)' } {'(181, 3078)' } {'(-867, -3347)' } {'(-670, -3501)' } {'(842, 3900)' } {'(-959, 2390)' } {'(-943, 1533)' }
That doesn't seem very useful to me, but it seems to be what you are asking to do.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!