Why I knock into a error when I want to get data from my double?
Mostra commenti meno recenti
R = [[1 0.9954 0.9994 0.9989];
[0.9954 1 0.9926 0.9923];
[0.9994 0.9926 1 0.9977] ;
[0.9989 0.9923 0.9977 1]];
% 一级偏相关系数
R_PC1 = [PC1(1,2,3) PC1(1,2,4) PC1(1,3,2) PC1(1,3,4) PC1(1,4,2) PC1(1,4,3)
PC1(2,3,1) PC1(2,3,4) PC1(2,4,1) PC1(2,4,3) PC1(3,4,1) PC1(3,4,2)];
% 二级偏相关系数
R_PC2 = [PC2(1,2,3,4) PC2(1,3,2,4) PC2(1,4,2,3) PC2(2,3,1,4) PC2(2,4,1,3) PC2(3,4,1,2)];
% 计算一级偏相关系数
function[r] = PC1(a,b,c) % 在c不变的情况下,a和b之间的相关系数
r = (R(a,b)-R(a,c)*R(b,c))/sqrt((1-R(a,c)^2)*(1-R(b,c)^2));
end
function[r] = PC2(a,b,c,d) %在c,d不变的情况下,a和b之间的相关系数
r = (PC1(a,b,c)-PC1(a,d,c)*PC1(b,d,c))/sqrt((1-PC1(a,d,c)^2)*(1-PC1(b,d,c)^2));
end
This program knock into a error at line15 and it read'出错 coord>PC1 (第 15 行)'
检查对函数 'R' 的调用中是否存在不正确的参数数据类型或缺少参数。
It seems that MATLAB see the 'R' as a function rather than a Matrix
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su QSP, PKPD, and Systems Biology in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!