I want to read ascii file into matlab which has 191 rows and 9 columns. Then I have to convert it into matrix form that too row wise also I have to convert magnitude and angle into real and imaginary parts.
2 views (last 30 days)
Show older comments
The data below is in 9 columns. The first column is for frequency, which is in hertz. The second column is for S11 magnitude, the third for S11 angle, the 4th column is S12 magnitude, the 5th is S12 angle and so on. All eight columns are S-parameters which are in magnitude and angle and I have to take them row by row, and read this data directly into matlab, and then form a matrix. Then I have to convert it into real and imaginary parts.
. # Hz S MA R 50
row 1 : 1000000000.000 +9.8103468350E-001 -1.1212773233E+001 +7.5138900895E-002 +6.7503685995E+001 +7.5911915353E-002 +7.7612286233E+001 +6.6197497335E-001 -5.5698989097E+000
row 2 : 1100000000.000 +9.7789664654E-001 -1.2343173752E+001 +8.2372076274E-002 +6.7164745132E+001 +8.3032257289E-002 +7.6655276053E+001 +6.6534801460E-001 -6.0731137365E+000
row 3 : 1200000000.000 +9.7414597496E-001 -1.3450479844E+001 +8.9137342173E-002 +6.6984995092E+001 +9.0037093048E-002 +7.5847505505E+001 +6.6377100820E-001 -6.7338426347E+000
row 4 : 1300000000.000 +9.7079182625E-001 -1.4524257360E+001 +9.6368252287E-002 +6.6520385977E+001 +9.7232350444E-002 +7.4786965364E+001 +6.6260679152E-001 -7.1749452934E+000
row 5 : 1400000000.000 +9.6708627191E-001 -1.5607081020E+001 +1.0320309179E-001 +6.6173275207E+001 +1.0372396159E-001 +7.3691071630E+001 +6.6218596876E-001 -7.6584585544E+000
row 6 : 1500000000.000 +9.6345447413E-001 -1.6659061335E+001 +1.0998283042E-001 +6.5718349968E+001 +1.1088458742E-001 +7.2508135318E+001 +6.6157989011E-001 -8.1416809458E+000
row 7 : 1600000000.000 +9.5914548536E-001 -1.7737862984E+001 +1.1668774834E-001 +6.5174792956E+001 +1.1751354475E-001 +7.1622743616E+001 +6.6018222718E-001 -8.6633952654E+000
0 Comments
Accepted Answer
Matt Kindig
on 18 Sep 2012
To read the ASCII file into Matlab:
doc textscan
To convert from magnitude-angle to complex a+bj, just use
Complex= Magnitude.*exp(j*Angle);
10 Comments
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!