MATLAB: How to read the first term of the file


Hi, I would know if someone can help me with this. In the file I have, I only need to read the first column (the one which is supposed to be the time). Anyone know how can I do that?

Best Answer

  • It is not possible to read only that column, but it is possible to have only that column saved.
    fid = fopen('force.dat', 'r');
    times = cell2mat( textscan(fid, '%f%*[^\n]', 'HeaderLines', 4) );