Tables and files in matlab

조회 수: 1 (최근 30일)
SAR SAR
SAR SAR 2019년 7월 7일
답변: Peter Perkins 2019년 7월 8일
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

채택된 답변

Kaustav Bhattacharya
Kaustav Bhattacharya 2019년 7월 8일
  1. https://www.mathworks.com/help/matlab/ref/fscanf.html - Use this to read the lines. You will get a 1xn vector with each line.
  2. https://www.mathworks.com/help/matlab/ref/strsplit.html - Use this to split each string with ';' (semicolon) delimiter.
  3. https://www.mathworks.com/help/matlab/ref/table.html - create a table.

추가 답변 (1개)

Peter Perkins
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.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by