フィルターのクリア

some questions about how to read and write txt file on matlab

2 ビュー (過去 30 日間)
vx2008
vx2008 2014 年 6 月 7 日
編集済み: dpb 2014 年 6 月 8 日
I have create an txt file as below:
then I can read it into matlab by csvread/dlmread, which is ok.but when I change the file as below, it will be never read again:
1. So how shall I read the txt file as above into matlab normally?
2. how shall I add or delete some date, such as numbers 1,2,4 or charactors a,b,c and so on into the txt file?
3. image that an txt file was written by an procedure about 1 time 1 data per 0.1 seconds and the txt file would be written done (completed), then I will read this file at once to get the last data by matlab and do some computing for it. question: how shall I know the file is done or not by matlab?
thank you

採用された回答

dpb
dpb 2014 年 6 月 7 日
編集済み: dpb 2014 年 6 月 8 日
1) When you switch to mixed character/numeric data, then csvread and friends are no longer suitable to use--they can't (and are documented to not) handle anything except regular all-numeric input. If you must make such changes, you'll need to use textscan that will return a cell array and you'll also have difficulty if the format of which field within the array changes form in reading the file as anything but fully text as the formatting will need to match. Looks like a very overhead-intensive way to try to do things.
2) See above; keep the whole thing as character or make a different storage structure of separate lists to handle the two if must have both types.
3) That's a tough one because of file buffering and all in the OS that you don't have direct control of. What's the other process; can it read input from standard input so you could dispatch with SYSTEM? Or, look at memmapfile and into using a flag variable.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by