Importing data from specific line

36 ビュー (過去 30 日間)
David Kerres
David Kerres 2019 年 11 月 4 日
回答済み: Roshni Garnayak 2019 年 11 月 7 日
Hey guys,
I have a very basic question. I have a .csv file containing a lot of information I don't want to import my myworkspace. The data I want to import to a table or matrix starts in line 46. How can I cut all the other data to just import the numbers out of the text file?
Hope you can help me,
David
  2 件のコメント
Guillaume
Guillaume 2019 年 11 月 4 日
Some of the import functions such as textscan and readtable have an option to skip any number of header lines. However, the main issue is that your file is encoded in UTF16 which matlab doesn't officially support (a bit ironical since matlab use UTF16 internally!)
While matlab can still read the file, you'll always get a wall of warning messages if you do. Is there an option to get the file in another encoding (UTF8 ideally).
David Kerres
David Kerres 2019 年 11 月 4 日
Thanks for your answer! I just found an option to get the .csv file without the parameterblock and in UFT8. Now it works. Thank you very much!

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

回答 (1 件)

Roshni Garnayak
Roshni Garnayak 2019 年 11 月 7 日
You can use the ‘readmatrix’function to import data from your .csvfile. To specify the range of data that you want to import, use the Name-Value pair argument ‘Range’ while calling the ‘readmatrix’ function.
For further details and examples on how to specify the range refer to the following documentation:

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by