erratic results while using dlmread function
4 views (last 30 days)
Show older comments
HI I am using dlmread function to take specific data from .txt file. My data contains 10 text lines(rows) then set of numerical data of size 8 rows and 17 columns I want element at position 17th row(including first 10 text lines) and 14th column. So I used command like: a= dlmread('file name', '', [16 13 16 13]) But its showing error as mismatch in file format and string. When I just modified column number and entered command as a= dlmread('file name', '', [16 15 16 15] Its takes input of element from 17th row and 16th column(as expected) and does not show any error. Thus I found that when I enter columns less that 15 its showing error but for columns greater than 15 it works well. What may be the problem in this case?? Please reply soon. Urgent help is needed.
0 Comments
Answers (2)
Walter Roberson
on 6 Sep 2011
Tips
All data in the input file must be numeric. dlmread does not read files that contain nonnumeric data, even if the specified rows and columns contain only numeric data.
Your 10 text lines of headers are creating problems. You cannot use dlmread() for that file.
(I would speculate that if you examine your text headers, you will find that the longest header has 15 columns.)
Nikhil CD
on 10 Sep 2011
2 Comments
Walter Roberson
on 10 Sep 2011
You could, but it would possibly be easier to switch to using textscan() .
Question: are there any negative values in the file?
See Also
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!