I have a tab delineated textfile which is formatted as below;
1 2 3 4 5 6 7 8
1 * * * 5 * * *
1 * * * * * * *
1 * 3 * * * * *
1 * * * * * * 8
The first row of data is headers which I am not loading. I have used a * above to represent an emptydata value in the text file. The first column has continuous values but the rest are mostly made up of empty values.
I have tried using textscan to load the data but it only seems to load the first column and ignore the others even though I have tried to set it up to deal with empty values. The code I am using for this is;
indata = textscan(fid, '%s%s%s%s%s%s%s%s', 'Delimiter', '\t', 'HeaderLines',1, 'EmptyValue',0);
fclose(fid);
data = indata{1};
The desired output I am looking for is;
1 2 3 4 5 6 7 8
1 0 0 0 5 0 0 0
1 0 0 0 0 0 0 0
1 0 3 0 0 0 0 0
1 0 0 0 0 0 0 8
What do I need to change to the code above to get it to do this?
Best Answer