Multiple lines in one cell using textscan

Hey,
I am trying to read files in which each data entry is limited by ";".
If I use textscan and set ';' as delimiter, it starts new cells when it reaches ";", but also every time a new line starts.
Is there a way to get textscan to only start a new cell when it reads the delimiter and ignore newline characters?
Thanks in advance.

4 件のコメント

Ameer Hamza
Ameer Hamza 2020 年 11 月 30 日
編集済み: Ameer Hamza 2020 年 11 月 30 日
Experiment with the 'LineEnding' option in textscan(). Attaching a sample file will help in suggesting a solution.
David-Sharif Kohlberger
David-Sharif Kohlberger 2020 年 11 月 30 日
I have attached an example file. In the original file there are multiple of those blocks after one another.
Do you mean the 'EndOfLine' option? For me textscan does not recognize 'LineEnding'
Ameer Hamza
Ameer Hamza 2020 年 11 月 30 日
Can you show the textscan command you are using? LineEnding is introduced in later releases.
David-Sharif Kohlberger
David-Sharif Kohlberger 2020 年 11 月 30 日
FileStringsDraft=textscan(fid,'%s','Delimiter',';','CommentStyle','#','EndOfLine',';');
This is the one I've been trying now. The EndOfLine option seems to work now. Thank you.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeText Data Preparation についてさらに検索

製品

リリース

R2019a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by