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