필터 지우기
필터 지우기

To read a text file using matlab

조회 수: 3 (최근 30일)
punith
punith 2012년 3월 6일
hi, this is a simple question
v='C:\Users\punith\Desktop\1.txt';% path
how to read text file using v

채택된 답변

Honglei Chen
Honglei Chen 2012년 3월 6일
Use fopen to open the file and then use fscanf or fgetl to read in the content. You can also use fread. For example, the following code reads the first line of the text.
fid = fopen(v,'r');
tline = fgetl(fid);
fclose(fid)
Just to remember close the file using fclose afterwards.
doc fopen
doc fclose
doc fread
doc fscanf
doc fgetl
  댓글 수: 1
punith
punith 2012년 3월 6일
thank u so much Honglei Chen

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by