Get an Inf value of characteristic path length via BCT

Summary of what happened:

I’m a novice to use Brain Connectivity Toolbox and trying to calculate topological measurements via it. I get an Inf value of characteristic path length when using the script.
(Actually, I also get Inf values in L variable.)

It works well for most subjects, but I get Inf values from some subjects.
Does anyone know how to solve this problem?

Command used (and if a helper script was used, a link to the helper script or the command generated):

W = CorrMatrix; % CorrMatrix is a correlation matrix consisting of 272 nodes across the whole brain. The correlations are not converted to Z values yet.

W_nrm = weight_conversion(W, 'normalize');

W_thr = threshold_proportional(W_nrm,spa);

L = weight_conversion(W_thr, 'lengths');

[D, B] = distance_wei(L);

lambda = charpath(D);

Version:

2019-03-03

Environment (Docker, Singularity, custom installation):

Matlab