필터 지우기
필터 지우기

Read Data From txt file using uigetfile...

조회 수: 9 (최근 30일)
Masoud Ghanbari
Masoud Ghanbari 2013년 6월 21일
Hi
I Have to read a file using uigetfile by this code by i face the error...
[filename,pathname,d] = uigetfile('*.txt;');
filepath=fullfile('pathname','filename');
fid = fopen('filepath');
mline1 = textscan(fid, '%f%s%s%f%f%s%s%f%f ','HeaderLines',5);
fclose(fid);
Error:
Error using textscan
Invalid file identifier. Use fopen to generate a valid
file identifier.
By The Way I Already have done it without using uigetfile...
another point is data should be a number not a string cause they are going to plotted... What should i do to convert them???
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 6월 21일
For the bit about it needing to be a number, we need a sample input line.

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 6월 21일
do not put the aote matks around filepath.
fopen(filepath)
  댓글 수: 9
Walter Roberson
Walter Roberson 2013년 6월 22일
mline_num = [mline1{[1:5 7]}];
mline_txt = mline1{6};
Masoud Ghanbari
Masoud Ghanbari 2013년 6월 23일
Thanks Dear Walter And Dear Azzi...

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

추가 답변 (0개)

카테고리

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