MATLAB: Deleting the first 4 rows of a .csv file.

csvdata importdelete rows

Hi everyone.
I looked at the answers from this thread and used:
>> m=dlmread('IR_00190.csv',',',4,0)
but it didn't work. Does anyone know how to get the data from the .csv file?
Thanks for the help.

Best Answer

Use the xlsread function:
[NUM,TXT,RAW] = xlsread('IR_00190.csv');
then:
STR = [TXT{5:end}]; % Convert Cell To String
PCEL = regexp(STR, ',', 'split'); % Parse String
VCT = cellfun(@str2double,PCEL(2:end)); % Convert To Double
MTX = reshape(VCT, 241, []); % Reshape To Matrix
This produces a (241x321) matrix of numeric variables. You may want to edit the original vector or the matrix to get the (240x320) matrix you want. The difference are 561 elements.