Error using pdist The distance function

2 visualizzazioni (ultimi 30 giorni)
Felipe  Lima
Felipe Lima il 15 Giu 2022
Commentato: Walter Roberson il 15 Giu 2022
Hello everyone, I have a CSV database, I import this database into mathlab and call them ab_table_Stool_real and Ko_table_Stool_real. However, when I run them in the code below, the following error appears: Error using pdist. The distance function 'distfun_WeightedJaccard' was not found. I would really appreciate it if anyone knows what's going on.
%% Taxonomic diversity, Functional diversity, and Functional redundancy calculation
% filtering
ab_table_real=ab_table_real(:,sum(ab_table_real>0,1)>5);
% Real taxonomic profile
dij_real=pdist(ko_table_real,@distfun_WeightedJaccard);
[SD_real, FD_real, FR_real]=FDFR_Rao_q (ab_table_real, dij_real);
% Null-GCN-1
ko_table_NULL_1=KO_matrix_random(ko_table_real,1);
dij_NULL_1=pdist(ko_table_NULL_1,@distfun_WeightedJaccard);
[SD_NULL_1, FD_NULL_1, FR_NULL_1]=FDFR_Rao_q (ab_table_real, dij_NULL_1);
% Null-GCN-2
ko_table_NULL_2=KO_matrix_random(ko_table_real,2);
dij_NULL_2=pdist(ko_table_NULL_2,@distfun_WeightedJaccard);
[SD_NULL_2, FD_NULL_2, FR_NULL_2]=FDFR_Rao_q (ab_table_real, dij_NULL_2);
% Null-GCN-3
ko_table_NULL_3=KO_matrix_random(ko_table_real,3);
dij_NULL_3=pdist(ko_table_NULL_3,@distfun_WeightedJaccard);
[SD_NULL_3, FD_NULL_3, FR_NULL_3]=FDFR_Rao_q (ab_table_real, dij_NULL_3);
% Null-GCN-4
ko_table_NULL_4=KO_matrix_random(ko_table_real,4);
dij_NULL_4=pdist(ko_table_NULL_4,@distfun_WeightedJaccard);
[SD_NULL_4, FD_NULL_4, FR_NULL_4]=FDFR_Rao_q (ab_table_real, dij_NULL_4);
  2 Commenti
Star Strider
Star Strider il 15 Giu 2022
You are apparently using code originally written by someone else, who created the ‘distfun_WeightedJaccard’ function. You will need to look for it in the code you are using, and then put the function somewhere in your MATLAB search path.
Walter Roberson
Walter Roberson il 15 Giu 2022
https://github.com/liangtian85/FR/blob/master/distfun_WeightedJaccard.m

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by