MATLAB: I want to read this text file from Matlab directly and want to import data of all columns into work space in an array.

fid = fopen('1.txt');
a = textscan(fid,'%s%s%s%s%s%s%s','Delimiter','','Headerlines',4);
lines=a{1:7};
fclose(fid)

Best Answer

Your file appears to contain 10 lines. You ask to skip the first 4, which would leave 6. You then ask to read 7 lines. You are going to have difficulty with the 7th value.