How can I write a text file using java in a way Matlab understands the text file on import ?

2 ビュー (過去 30 日間)
The Text file contains mapping information between two variables, data type of each of the variables etc. The information to be written to the text file is extracted from database. How can I write this information to the text file using java so that Matlab understands the text file on import and produces .mat file from my input text file.
Any help would be appreciated. Thanks !!

採用された回答

Walter Roberson
Walter Roberson 2016 年 8 月 3 日
MATLAB can read any text file, but some formats are easier to parse than others.
With the variety of information you have and the fact you have different data types, you might want to consider writing XML in Java and then using xmlread() in MATLAB.
  2 件のコメント
Vinay  Sheshadri
Vinay Sheshadri 2016 年 8 月 4 日
Thanks for your reply !!
Agreed. In that case the XML file that I write in java. How do I import this file onto my matlab using java from eclipse ?
Despite of the fact that XML would be efficient way , Is it still possible that I implement it using text files ? (Yes/No)
Walter Roberson
Walter Roberson 2016 年 8 月 4 日
If you look inside the code for xmlread() you will see that it can take a couple of different kinds of java objects in addition to a plain file name. It ends up invoking java methods to do the XML parsing.
Yes, it is possible to implement an information transfer using plain text files. We would need a sample file or two in order to tell you the better ways to parse it.

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

その他の回答 (0 件)

カテゴリ

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