Info

此问题已关闭。 请重新打开它进行编辑或回答。

subscript assignment to dataset array

3 次查看(过去 30 天)
Pinkvirus
Pinkvirus 2015-4-8
关闭: MATLAB Answer Bot 2021-8-20
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

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by