mrdivide error for cell array divided by constant

조회 수: 4 (최근 30일)
Pinkvirus
Pinkvirus 2015년 4월 7일
댓글: Pinkvirus 2015년 4월 8일
Hi, I'm trying to divide values in a cell array by a constant in a vector:
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,totalSamples);
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
The last section which creates the cell called norm, is where I get the following error:
Undefined function 'mrdivide' for input arguments of type 'dataset'.
Error in diagnoseTargets_falciparum (line 22) norm{n}(:,k + 1) = chrom{n}(:,k)/xbar(n,k-3);
neither chrom or xbar are datasets. chrom is a cell array and xbar is a matrix.
Anyone know why I am getting this error? or how to fix it?
Thanks!
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2015년 4월 7일
Pinkvirus - put a breakpoint at the line
norm{n}(:,k + 1) = chrom{n}(:,k)/xbar(n,k-3);
and run your code. When the debugger pauses at the above line look at chrom{n}(:,k) and xbar(n,k-3). What are the data types for each?
Pinkvirus
Pinkvirus 2015년 4월 8일
Geoff
chrom{n}(:,k) is dataset and xbar(n,k-3) is double
now I see, thank-you.
But, how to make it so inside the cell array, chrom{n}(:,k) is not a dataset?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by