Skip to content

Instantly share code, notes, and snippets.

@gognjanovski
Created November 30, 2018 13:01
Show Gist options
  • Save gognjanovski/face08670ccb4e842490e28b82d98478 to your computer and use it in GitHub Desktop.
Save gognjanovski/face08670ccb4e842490e28b82d98478 to your computer and use it in GitHub Desktop.
Get Csv Data
function data_reshape = getCsvData(filename)
%GETCSVDATA load the csv data into cell array
fileID = fopen(filename,'r');
% Start row is 1 since the first line is the heading (name of the columns)
startRow = 1;
data = textscan(fileID, '%d %d\n', 'Delimiter', ';',...
'HeaderLines', startRow,'ReturnOnError', false);
fclose(fileID);
[M N] = size(data{1,1});
data_reshape = cell(M,2);
for i=1:M
data_reshape{i, 1} = data{1,1}(i);
data_reshape{i, 2} = data{1,2}(i);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment