how to read a data from text file

1 回表示 (過去 30 日間)
zein
zein 2021 年 4 月 10 日
編集済み: dpb 2021 年 4 月 10 日
I want to read data from text file formatted as follows:
number 7 is the number of points and they are listed in form of (x y z).
_____________________________________________________________________________________________________________________________-
7
(
(-1.4330704e-08 2.9000119e-12 0)
(1.0601769e-06 -0.0001249935 0)
(1.0601769e-06 0.00012499351 0)
(-1.4330704e-08 2.9000119e-12 0.00016666667)
(1.0601769e-06 -0.0001249935 0.00016666667)
(1.0601769e-06 0.00012499351 0.00016666667)
(4.391607e-06 -0.00025131502 0)
)
____________________________________________________________________________________________________________________________________
how to exclude the first 2 lines and last one and only include numbers inside the brackets and export the as x,y and z arry

採用された回答

dpb
dpb 2021 年 4 月 10 日
編集済み: dpb 2021 年 4 月 10 日
zein=readlines('yourfilename.txt');
xyz=str2double(split(extractBetween(zein(3:end-1),'(',')')," "));
  1 件のコメント
zein
zein 2021 年 4 月 10 日
Thanks alot

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by