Info

この質問は閉じられています。 編集または回答するには再度開いてください。

impport ia txt file into matlab

1 回表示 (過去 30 日間)
Niki
Niki 2013 年 1 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
*I have a file in text and I want to sort its information into a xls file the text file is as follows which each part starts with BEGIN IONS and end with END IONS *
BEGIN IONS
TITLE=445.1185_908.046
PEPMASS=445.1185
RTINSECONDS=908.046
CHARGE=1
355.074005126953 543
223.07470703125 59
150.026992797852 97
END IONS
BEGIN IONS
TITLE=610.1826_-1
PEPMASS=610.1826
RTINSECONDS=-1
CHARGE=1
END IONS
BEGIN IONS
TITLE=536.1563_-1
PEPMASS=536.1563
RTINSECONDS=-1
CHARGE=1
END IONS
BEGIN IONS
TITLE=519.1368_-1
PEPMASS=519.1368
RTINSECONDS=-1
CHARGE=1
END IONS
*and I want to save it as follows in a xls file *
TITLE PEPMASS RTINSECONDS CHARGE
445.1185_908.046 445.1185 908.046 1 355.074005126953 543 223.07470703125 59 150.026992797852 97
610.1826_-1 610.1826 -1 1
536.1563_-1 536.1563 -1 1
  1 件のコメント
Niki
Niki 2013 年 1 月 17 日
no body knows ?

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 1 月 17 日
read the file as a single string using fileread(). Use regexp() with named tokens to extract the desired information. Create a cell array from the resulting structure array. xlswrite() the cell array.
  3 件のコメント
Image Analyst
Image Analyst 2013 年 2 月 1 日
So you just gave up? What about trying fgets() or fgetl(), textscan() etc. or any of the other functions listed at the bottom of the help for fileread() in the "See also" section? Then you might use strfind(), sscanf(), etc. Keep working at it.
Niki
Niki 2013 年 2 月 3 日
do not work , I also tried with fopen(), then fscanf(), still the sam,e if you have any other suggestion please let me know

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by