How to read and write this file?

조회 수: 2 (최근 30일)
Uday padidela
Uday padidela 2014년 11월 30일
댓글: Uday padidela 2014년 12월 1일
% h11 h12 h22
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065
-1.00002065 -1.00002065 -1.00002065

채택된 답변

Mohammad Abouali
Mohammad Abouali 2014년 11월 30일
[h11,h12,h22]=textread('data.txt','%f %f %f','headerlines',2);
  댓글 수: 7
Image Analyst
Image Analyst 2014년 11월 30일
It sounds like Mohammad's suggestion got you working so I'll ignore your comment to me below but you should mark his answer as Accepted to give him reputation points. My readtable answer should also have worked. You can also Vote for any answer that you liked even though you can accept only one.
I can't really tell if your code has any mistakes or not, just glancing at it. It looks like an alphabet soup of single and double letter variable names that's virtually impossible to follow without some kind of printed equation (that I imagine your variable names correspond to). But if it works, then it works. My only suggestion would be to put in many, many more comments and use more descriptive variable names so that people can follow it. It just makes your code more maintainable. Even by you. If you were to look at that code 5 years from now, would you be able to follow it?
Uday padidela
Uday padidela 2014년 12월 1일
I will surely follow your suggestions. It really helps me to follow up my code in future.
Thank you ..

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

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 11월 30일
Another option, if you can get rid of the % symbol on the first line: readtable():
t = readtable(filename);
  댓글 수: 3
Image Analyst
Image Analyst 2014년 11월 30일
Try dlmread with a space delimiter.
By the way, because you're not attaching your text file, it's causing us all of these back and forth guesses instead of letting us try something on your actual file and giving you the answer correctly the first time and making you go hours until you get a good answer. You might want to read our tutorial
Uday padidela
Uday padidela 2014년 11월 30일
I have attached the file below for clarification.

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

카테고리

Help CenterFile Exchange에서 Large 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