reading specific data from a ascii file
3 ビュー (過去 30 日間)
古いコメントを表示
HI everyone,
I am trying to access and import a part of a very large file (.ascii format) in matlab workspace. I tried with two approaches: 1. 'dlmread' but the exported data converts the -ve values into zero. I tried with changing the format with 'format long e' but no success. 2. fid = fopen('C:\s4.ascii'); format = repmat('%f', [1 nCols]); c = textscan(fid, format); here the problem is 'How to get a particular range of columns and rows in to matlab?'
Any help.
Thanks in advance.
0 件のコメント
採用された回答
Titus Edelhofer
2013 年 6 月 24 日
Hi,
for the columns you can use %*f to skip a column. Building the format string will be slightly more complicated of course, depending on which columns you want to have...
Second, for the rows, take a look at the third parameter 'N' for reading a specified number of rows and look for 'headerlines' to skip a specified number of rows ...
Titus
2 件のコメント
Titus Edelhofer
2013 年 6 月 25 日
Hi Vinay,
the %*f skips a column, not a line. For reading only a particular set of lines you would call textscan several times with using the "headerlines" parameter to skip a number of lines.
Titus
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!