'Unable to open file' error with importdata
조회 수: 52 (최근 30일)
이전 댓글 표시
I am trying to import data from a .txt file with the same structure as below
with the code below, I am looking for a .txt file and I try to save each column in a matlab file but matlab tells me 'Unable to open file'
[filename,pathname]=uigetfile({'*.fl.txt' 'Torque file (*.fl.txt)'},'Select a torque curve');
if filename ~= 0
Spill = importdata(filename);
extracted=Spill.data
CDC_N=extracted(:,1)
CDC_Torque=extracted(:,2)
save('CDC.mat','CDC_N','CDC_Torque');
end
if anyone could help me, I'd be grateful.
thanks
댓글 수: 0
채택된 답변
per isakson
2020년 8월 12일
편집: per isakson
2020년 8월 12일
Replacing
Spill = importdata(filename);
with
Spill = importdata( fullfile( pathname, filename );
may help.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!