'Unable to open file' error with importdata

67 visualizaciones (últimos 30 días)
Max-Henri Froger
Max-Henri Froger el 12 de Ag. de 2020
Comentada: Max-Henri Froger el 12 de Ag. de 2020
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

Respuesta aceptada

per isakson
per isakson el 12 de Ag. de 2020
Editada: per isakson el 12 de Ag. de 2020
Replacing
Spill = importdata(filename);
with
Spill = importdata( fullfile( pathname, filename );
may help.

Más respuestas (0)

Categorías

Más información sobre Data Import and Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by