フィルターのクリア

how can I only display all the data?

3 ビュー (過去 30 日間)
Manav Divekar
Manav Divekar 2022 年 1 月 30 日
編集済み: Voss 2022 年 1 月 30 日
from this txt fike how can i just get the data and asign to a variable

採用された回答

Voss
Voss 2022 年 1 月 30 日
編集済み: Voss 2022 年 1 月 30 日
If your version of MATLAB is R2019a or newer, you can use readmatrix():
filename = 'DHD_10%_sec_T1.txt';
data = readmatrix(filename);
format long
data
data = 20275×3
-0.000050862627887 -0.124530710279942 0.008000000379980 -0.000050862627887 -0.112610071897507 0.008999999612570 -0.000050862627887 -0.098028592765331 0.009999999776483 -0.000050862627887 -0.083013646304607 0.010999999940395 -0.000050862627887 -0.069782592356205 0.012000000104308 -0.000050862627887 -0.059479601681233 0.013000000268221 -0.000050862627887 -0.052053701132536 0.014000000432134 -0.000050862627887 -0.048166055232287 0.014999999664724 -0.000050862627887 -0.047958608716726 0.016000000759959 -0.000050862627887 -0.051448512822390 0.017000000923872
In older versions (or just as an alternative), you can use fscanf():
filename = 'DHD_10%_sec_T1.txt';
fid = fopen(filename);
for i = 1:8 % skip 8 header lines
fgetl(fid);
end
data = reshape(fscanf(fid,'%g'),3,[]).';
fclose(fid);
format long
data
data = 20275×3
-0.000050862627887 -0.124530710279942 0.008000000379980 -0.000050862627887 -0.112610071897507 0.008999999612570 -0.000050862627887 -0.098028592765331 0.009999999776483 -0.000050862627887 -0.083013646304607 0.010999999940395 -0.000050862627887 -0.069782592356205 0.012000000104308 -0.000050862627887 -0.059479601681233 0.013000000268221 -0.000050862627887 -0.052053701132536 0.014000000432134 -0.000050862627887 -0.048166055232287 0.014999999664724 -0.000050862627887 -0.047958608716726 0.016000000759959 -0.000050862627887 -0.051448512822390 0.017000000923872

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by