textscan to read date and time column and numeric data together

9 ビュー (過去 30 日間)
Sohail Hasan
Sohail Hasan 2022 年 7 月 1 日
コメント済み: Sohail Hasan 2022 年 7 月 1 日
dddd
Thank you Stephen23. I am attaching the file. The purpose is to read the file from row 66 to end. After that I want to Connect the columns of the read numbers horizontally. May be by using 'horzcat' command. Thank you
I am new to MatLAB. I want touse textscan command to read the data. the first column is date and time and rest are numeric. can anyone help me in this?
  1 件のコメント
Stephen23
Stephen23 2022 年 7 月 1 日
編集済み: Stephen23 2022 年 7 月 1 日
Try using READTABLE()
If you upload a sample file by clicking the paperclip button then someone can help you.

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

採用された回答

Stephen23
Stephen23 2022 年 7 月 1 日
T = readtable('WHP-SEA-TP116-HS417-S1.csv', 'NumHeaderLines',66)
T = 65629×7 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 ________________ _______ ______ ________ ________ _________ _______ 05/23/2022 11:57 0 2.8496 0.056305 0.019797 -0.03085 -0.1675 05/23/2022 11:57 10000 2.8496 0.056305 0.022843 -0.029307 0.169 05/23/2022 11:57 20000 2.8496 0.056305 0.025888 -0.029307 -0.1675 05/23/2022 11:57 30000 2.8494 0.056305 0.027411 -0.027765 0.1685 05/23/2022 11:57 40000 2.8494 0.054741 0.025888 -0.027765 -0.1665 05/23/2022 11:57 50000 2.8496 0.054741 0.024365 -0.026222 0.1675 05/23/2022 11:57 60000 2.8494 0.054741 0.025888 -0.027765 -0.1655 05/23/2022 11:57 70000 2.8494 0.056305 0.030457 -0.027765 0.1675 05/23/2022 11:57 80000 2.8496 0.054741 0.03198 -0.027765 -0.166 05/23/2022 11:57 90000 2.8496 0.056305 0.030457 -0.023138 0.1675 05/23/2022 11:57 1e+05 2.8496 0.053177 0.027411 -0.02468 -0.165 05/23/2022 11:57 1.1e+05 2.8496 0.054741 0.030457 -0.023138 0.1675 05/23/2022 11:57 1.2e+05 2.8496 0.054741 0.033502 -0.023138 -0.165 05/23/2022 11:57 1.3e+05 2.8496 0.056305 0.033502 -0.020053 0.167 05/23/2022 11:57 1.4e+05 2.8494 0.056305 0.03198 -0.021595 -0.1655 05/23/2022 11:57 1.5e+05 2.8496 0.054741 0.030457 -0.021595 0.1665
  1 件のコメント
Sohail Hasan
Sohail Hasan 2022 年 7 月 1 日
Thank you so much for your kind help and guidance

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

その他の回答 (1 件)

Kshittiz Bhardwaj
Kshittiz Bhardwaj 2022 年 7 月 1 日
Hello Sohail,
You have to first load open your file in MATLAB and then read each column with the appropriate conversion specifier.
You can refer : TextScan documentation
Personally, I would suggest you to use readTable instead of textScan as it is easier and straight forward

カテゴリ

Help Center および File ExchangeLaTeX についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by