MATLAB: How to import this simple CSV? Should I use textscan or something else

data importMATLAB and Simulink Student Suitetextscan

I am struggling to import data in MATLAB. The following code creates a 1×11 cell array with cells containing 0x0 char or NaN arrays, clearly wrong.
filepath = 'easy.csv';
% First we scan the file to see how many rows of data it has.
rows = 3; columns = 3;
RepetitionNumber = rows*columns;
% We construct the format spec based on this number of rows and columns.
formatSpec = ['%*s %*s %*s %*s %q %q',repmat('%f',[1,RepetitionNumber])];
% We read the file using textscan.
fileID = fopen(filepath);
DVH = textscan(fileID,formatSpec,'Delimiter',{',' '/n'});

Best Answer

I'm not sure how this is different from your other question. Again, use readtable which tremendously simplifies everything:
dvh = readtable('easy.csv', 'ReadVariableNames', false)