MATLAB Answers

Info

This question is closed.

0

How do I Import multiple data files?

Asked by Serena Solanki on 9 Feb 2018
Latest activity Closed by Stephen Cobeldick on 9 Feb 2018
Hi All
Hope you can help me with this! I am hopelessly struggling at trying to open 7 data files which have data arranged into rows rather than columns.
I also want to skip the first 4 lines in each txt file as they contain no data.
I have done the recommended steps- using the import data and creating a function.
then doing the following code in my main file:
numFiles = 7;
startRow = 5;
endRow = inf;
myData = cell(1,numFiles);
for fileNum = 1:numFiles
fileName = sprintf('Record_%d.txt',fileNum);
myData{fileNum} =importfile(filename, startRow, endRow)
end
Unfortunately I keep getting the error: unidentified variable 'filename' I am not sure where I am going wrong Do I need to name the function I am using somewhere?
Thanks

  0 Comments

Tags

0 Answers