Reputation: 575
My code looks as so:
PosHotspot = dataset('file', 'PositiveHotspotpos.txt', 'Delimiter', '\t');
a = 2;
exon_end = PosHotspot.total_exon;
exonposition = PosHotspot.ExonPos;
Isoformnumber = PosHotspot.Isoform;
fileID = fopen('PosHotspot_results.txt', 'w')
for j = 1:660
exon = exonposition(j:j);
Isoform = Isoformnumber(j:j);
b = exon_end(j:j) - 1;
rng(0, 'twister');
r=randi([a b],1,1000);
less = sum(exon>r);
greater = sum(exon<r);
equal = sum(exon==r);
fprintf(fileID, '%s %4f %4f\n',Isoform,less,greater)
end
fclose(fileID)
However, I keep getting this error:
Error using fprintf
Function is not defined for 'cell' inputs.Error in PositiveHotspotttest (line 24)
fprintf(fileID, '%s %4f %4f\n',Isofrom,less,greater)
I'm certain that it has to do with writing my information from Isoforms to the file.
Here's an example of what my file looks like:
chrom Gene Isoform exon_start ExonPos total_exon exonpos_exontotal
chr20 ADA NM_000022 43255096 4 13 0.307692307692
chr9 ALDOB NM_000035 104187734 7 10 0.7
chr5 ARSB NM_000046 78077674 7 9 0.777777777778
chr5 ARSB NM_000046 78135178 6 9 0.666666666667
chr5 ARSB NM_000046 78181406 5 9 0.555555555556
I want to output the Isoforms
to my new file as well as the greater than and less than values. Is there a way to do this?
It's probably pretty simple, but again I'm new to matlab
Upvotes: 0
Views: 112
Reputation:
Change:
Isoform = Isoformnumber(j:j);
to the more natural:
Isoform = Isoformnumber{j};
Like this you'll retrieve the content of the cell no. j
, instead of the whole cell.
Upvotes: 1