Info

This question is closed. Reopen it to edit or answer.

subscript assignment to dataset array

3 views (last 30 days)
Pinkvirus
Pinkvirus on 8 Apr 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I understand the problem with my code, that chrom{n}(:,k) is a dataset at each level of n. But i do not know how to correctly subscript chrom{n}, to get the data I need to perform the calculation. I could create a new matrix for each n, but I've been scolded about this before so I want to do it properly.
Thanks!
% calculate number of samples
file = diagnoseTargetsfalciparumEvolved2;
[a,b] = size(file);
totalSamples = b-4;
chrom = cell(16,1);
for n = 1:16;
chrom{n} = file(file.chr==n,:);
end
xbar = zeros(16,1);
for n = 1:16;
for k = 4:(totalSamples) + 3;
xbar(n,k-3) = mean(double(chrom{n}(:,k)),1);
end
end
norm = cell(16,1);
for n = 1:16;
norm{n}(:,1:4) = chrom{n}(:,[1:3,14]);
for k = 4:(totalSamples) + 3;
norm{n}(:,k + 1) =chrom{n}(:,k)/(xbar(n,k-3));
end
end

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!