erratic results while using dlmread function
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Walter Roberson
2011-9-6
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
2011-9-10
2 个评论
Walter Roberson
2011-9-10
You could, but it would possibly be easier to switch to using textscan() .
Question: are there any negative values in the file?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!