How to import text files with unrecognized file extensions

I'm working on a GUI to analyze data generated by another program. The data is in the form of text files with various descriptive files extensions like .eigen or .summary. I am having trouble importing these using 'importdata', 'fopen' and 'open'. These can be loaded into the workspace using the import wizard but I would prefer to have this operation performed by code in my GUI. I understand that the 'open' function can be extended to handle other file extensions but I am unclear on how exactly to do this. Any help would be greatly appreciated.
-Jeremy

 採用された回答

Jeremy
Jeremy 2013 年 9 月 4 日

2 投票

I ended up being able to fix this by changing the extension to .txt using
system(['rename ' oldname ' ' newname.txt]);
since they really were text files with different extensions this allowed me to import them without issue.

その他の回答 (1 件)

A Jenkins
A Jenkins 2013 年 9 月 4 日

0 投票

Did you say the Import Wizard is working for you? It has a checkbox that says "Generate MATLAB Code".
Does this provide the code you want?

2 件のコメント

Jeremy
Jeremy 2013 年 9 月 4 日
I tried this but I still get the same error as when using 'importdata' on its own
??? Error using ==> importdata at 136 Unable to open file.
Walter Roberson
Walter Roberson 2013 年 9 月 4 日
Possibly you are not in the correct directory at the time you attempt to import the file. How are you building the file name to import ?

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

カテゴリ

ヘルプ センター および File ExchangeLarge Files and Big Data についてさらに検索

製品

質問済み:

2013 年 9 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by