error while using dlmread

Hello
I am using dlmread to input data from .txt file. Actually file was having some character headers and texts. But as we cant use dlmread for file having texts in it. I deleted all the text in the file. So now there is only numerical data, 5rows and 12 coulumns. I want element which is at point 1st row and 10 th column. So the command I used is
a= dlmread('file name', '', [0 9 0 9])
But I am getting error as mismatch in file format and string.
What might be the reason?? Please reply soon. Urgent help required.

댓글 수: 6

Oleg Komarov
Oleg Komarov 2011년 9월 9일
Please post part of the content of your file, also with headers if you like and format it with the {} code button: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099
Andreas Goser
Andreas Goser 2011년 9월 9일
MATLAB release likely is also relevant
Walter Roberson
Walter Roberson 2011년 9월 9일
duplicate is at http://www.mathworks.com/matlabcentral/answers/15176-erratic-results-while-using-dlmread-function
Nikhil CD
Nikhil CD 2011년 9월 10일
Ok. I got the mistake..
Can any one tell me which function I can use to remove all the hyphens in my .txt file.
The column of hyphens in my file is causing error in dlmread.
Fangjun Jiang
Fangjun Jiang 2011년 9월 10일
Is the hyphen used as the delimiter? If yes, use a=dlmread('filename,'-',[0 9 0 9]);
Nikhil CD
Nikhil CD 2011년 9월 12일
No hyphen is not delimiter. comma(,) is delimiter.
in my dat I am having column of hyphens(its automatically generated data so whenever there no data element available it generates hyphen)

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 9월 9일

0 개 추천

a=magic(12);
b=a(1,10)
dlmwrite('test.txt',a);
r=dlmread('test.txt',',',[0 9 0 9])

카테고리

질문:

2011년 9월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by