How can I solve the eror " Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier. " for this code ?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
function [load_time_stamp, load_value]=get_the_actual_demand_data()
filename = 'dee1.csv'; delimiter = ','; startRow = 2;
formatSpec = '%s%*s%[^\n\r]'; fileID = fopen(filename,'r');
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1);
%dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
load_time_stamp = dataArray{:, 1};
fclose(fileID);
formatSpec = '%*s%f%[^\n\r]'; fileID = fopen(filename,'r');
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines' ,startRow-1);
%dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
load_value = dataArray{:, 1};
fclose(fileID);
end
4 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Text Files in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!