Searching contents in a text file.

3 ビュー (過去 30 日間)
Adam Glick
Adam Glick 2015 年 11 月 10 日
回答済み: Jayanti 2025 年 2 月 11 日
Hi. I'm trying to read in a text file in MATLAB. I am trying to extract certain information that I can use in a different code. Here is my question:
1) How do I read in all components of the text file? 2) How is the data presented in MATLAB? 3) How do I extract the information I need?
Thanks.

回答 (1 件)

Jayanti
Jayanti 2025 年 2 月 11 日
Hi Adam,
To read and extract data from text files in MATLAB, you have several options depending on the data present in the file:
  1. Use “readtable" for tabular data with mixed types. It allows for easy manipulation and accessing the data using the column names.
  2. You can use “readtimetable" for file which has tabular data where rows are associated with a time.
  3. If the file has for uniform numeric data use “readmatrix".
  4. If the file has for non-uniform data, where each cell can contain different data types “readcell" can be used.
  5. For plain text files use “readlines".
Please refer to the following documentation link for more information on importing text files:

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by