Search code examples
matlabtextscantabstop

reading tabstops as 4 whitespaces using textscan


Is it possible to tell MATLAB's textscan to import tabs as four whitespaces? Currently it's replacing a tab with just one whitespace:

raw = textscan(fid,'%s','Delimiter','\n','Whitespace','');

Thank you in advance :)


Solution

  • Thank you @Dev-iL,

    I thought maybe there is some option to add to textscan, but now I added as you suggested another line of code:

    raw = textscan(fid,'%s','Delimiter','\n','Whitespace','');
    raw = regexprep(raw{1},'\t','    ');