textscan(f​id,'%s','d​elimiter',​{'\r','\n'​}) lost a Tab located in the very beginning of 1st row of text file

4 views (last 30 days)
Hi, I am using textscan to read a tsv file.
This tsv file has an empty cell in the {1,1} position, but the textscan lost this tab:
afn = 'C:\Users\rmd\Desktop\test.txt';
fid = fopen(afn,'r');
rawData = textscan(fid,'%s','delimiter',{'\r','\n'},'MultipleDelimsAsOne',1);
rawData{1}
'genotype date age n_genes n_counts mt_frac cell_types_integrated broad_annotation neurotransmitter UMA…'
'AAACCCACAACATACC-1-mini-2020-06-18-5d mini 2020-06-18 5d 1018 1781.1062 0.039784227 N-53-Glut Neuron Glu…'
'AAACCCACAACTTCTT-1-mini-2020-06-18-5d mini 2020-06-18 5d 841 1575.952 0.04052638 N-0-undef Neuron undefin…'
'AAACCCAGTAGTCTGT-1-mini-2020-06-18-5d mini 2020-06-18 5d 1667 4609.9756 0.00064537866 N-6-GABA Neuron…'
How to let textscan get that tab?

Accepted Answer

埃博拉酱
埃博拉酱 on 7 Apr 2023
Specify Whitespace='' in textscan.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!