I'm currently just trying to import a csv file into matlab so that I may plot columns 1 and 2.
I have the following code below which checks for any CSVs files in a given directory and imports their data.
However, the problem I'm encountering is that given the format of the time in my CSV file, it yields an error claiming.
Mismatch between file and format character vector.
Trouble reading 'Numeric' field from file (row number 1, field number 2) ==> :00:00,2\n
This problem is solved if I just skip the time column entirely. But I need to import the time and I can't just skip the time column.
Is there any way I can import the time given its current formatting? I have the CSV file attached to this post for reference.
The code I'm running:
myFolder = 'C:\Users\User1\Desktop\Search here\Batch CSVs';
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
filetype = '.fig';
filePattern = fullfile(myFolder, '*.csv');
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
dataArray = csvread(fullFileName,1,0);
time = dataArray(:,1);
weight = dataArray(:,2);