필터 지우기
필터 지우기

How can I Read all the details of my .txt file

조회 수: 1 (최근 30일)
mohsen moslemin
mohsen moslemin 2018년 9월 18일
답변: mohsen moslemin 2018년 9월 19일
I want to read my .txt file in MATLAB and then keep specific rows and columns, Also would it be possible to read .txt file without mentioning it's name.txt in the process of reading the file ?
Thanks
  댓글 수: 2
Rik
Rik 2018년 9월 18일
There are may examples of how to read the contents of a file that you can find online. What did you try and what errors did you get? This looks tab-delimited, so you should be able to read this to a matrix, or even a table with the built-in Matlab tools.
mohsen moslemin
mohsen moslemin 2018년 9월 18일
Great, I tried A=tdfread('YMR.txt',',') Now I have 17559x727 Char would it be possible to select specific rows and columns? Thanks

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

채택된 답변

Rik
Rik 2018년 9월 19일
If you use dlmread, you can define a number of rows you would like to skip. You can use '\t' to use tab as delimiter.

추가 답변 (2개)

mohsen moslemin
mohsen moslemin 2018년 9월 19일
Using dlmread, I'm getting this error, Mismatch between file and format string. when i removed top sectio nof my text file and only numbers left then i have access to all my data in matrix form, is there anyway I can automatically remove top section of my text file as i dont need it anyway.

mohsen moslemin
mohsen moslemin 2018년 9월 19일
Ok I found another way around it, apparently you can read with A=tdfread then use cell2mat(struct2cell(A)) to have your matrix. that is what I needed thanks.

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by