Importing text file data?
Mostra commenti meno recenti
Hello everyone,
I have written a function that imports .txt files and removes the 5 header lines. Right now the function only reads .txt files with 6 columns of data. I am trying to make this file more robust, so that it can read .txt files with any number of data columns up to say 12. I am not sure how to appproach this and was looking for some help in doing so. Here is my function:
function[data]=Load_Data(filename,strain_command_data)
FID=fopen(filename);
data=textscan(FID,%f%f%f%f%f%f','HeaderLines',5,'CollectOutput',1);
fclose(FID);
data=data{1}
rows_remove=find(data(:,strain_command_data)==0);
if (~isempty(rows_remove)),
data=data(1:rows_remove(1)-1,:);
end
end
Any help would be great.
1 Commento
per isakson
il 14 Nov 2013
Did you search the File Exchange for ideas?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Text Files in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!