フィルターのクリア

'Unable to open file' error with importdata

31 ビュー (過去 30 日間)
Max-Henri Froger
Max-Henri Froger 2020 年 8 月 12 日
コメント済み: Max-Henri Froger 2020 年 8 月 12 日
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

採用された回答

per isakson
per isakson 2020 年 8 月 12 日
編集済み: per isakson 2020 年 8 月 12 日
Replacing
Spill = importdata(filename);
with
Spill = importdata( fullfile( pathname, filename );
may help.
  1 件のコメント
Max-Henri Froger
Max-Henri Froger 2020 年 8 月 12 日
thanks, it was the problem

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by