Reading text from a txt file into a cell array
3 ビュー (過去 30 日間)
古いコメントを表示
The text file (trial.txt) is as follows:
line1
line2
line3
and I used k = fileread('trial.txt') to get the text into a cell array 'k'. Now the problem is, it takes the whole text as a single line. But I want it to be separate rows in the array (for each new line). Am not sure about how I should do that. I tried using textscan also and ended up getting nothing from the text file. My knowledge in MATLAB is limited. Please help me out of this. Thanks
0 件のコメント
回答 (3 件)
Matt Fig
2011 年 3 月 10 日
What does the data on each line look like? Does it follow a pattern? Post one of the lines if all lines follow a similar pattern, because you should be able to do this with TEXTSCAN.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!