フィルターのクリア

How to extract text and value from a .txt file ?

2 ビュー (過去 30 日間)
Karim
Karim 2017 年 9 月 29 日
コメント済み: Karim 2017 年 10 月 3 日
Hi,
i have to import an array from a .txt file into Matlab. The problem is I have 2 arrays of similar shape that contain text and numbers (I would like both).
I tried using "uiimport" (which is convenient since I'm making a GUI): It works well with the file1 : I get a "data" matrix (I don't know what it is) and a "textdata" cell array which I can work with.
However here is the problem, with the file2, the "textdata" cell array only contains the first line.
Could you please help me find a solution ?
(I suggest the problem may be related to the last column being empty)
  7 件のコメント
Kian Azami
Kian Azami 2017 年 10 月 2 日
@Guillaume thank you for your comment. I didn't know it. For the next times I will answer the questions instead of put a comment.
Karim
Karim 2017 年 10 月 3 日
Thank you for your help, this helped me to resolve my problem.

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

採用された回答

aL
aL 2017 年 9 月 29 日
You can use the readtable command.
filedata = readtable('file2.txt','delimiter','\t','readvariablenames',true);
  1 件のコメント
Karim
Karim 2017 年 10 月 3 日
Thank you for your help

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by