MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   how to solve this error: "Subscript indices must either be real positive integers or logicals"? (https://www.labfans.com/bbs/showthread.php?t=22131)

poster 2019-11-25 20:00

how to solve this error: "Subscript indices must either be real positive integers or logicals"?
 
<p>I wrote this program for computing the average of the distance between each feature and the rest of the features in the colon dataset. I defined a function for computing Chebyshev distance.</p>

<pre><code>close all;
clc
load colon.mat
data=colon;
[n,m]=size(data);
for i=1:m-1
for j=i+1:m
t(i,j)=fChebyshevDist(data(:,i),data(:,j));
b=sum(t)/(m-1);
end
end


function [ fchd ] = fChebyshevDist(p,q)
fchd=max(abs(p-q));
end
</code></pre>

<p>I found this error "Subscript indices must either be real positive integers or logicals" for this line:</p>

<pre><code> t(i,j)=fChebyshevDist(data(:,i),data(:,j));
</code></pre>

<p>that I really haven't got any idea to solve. I'll be very grateful to have your opinions. Thanks</p>



[url=https://stackoverflow.com/questions/59031365/how-to-solve-this-error-subscript-indices-must-either-be-real-positive-integer]More answer...[/url]


所有时间均为北京时间。现在的时间是 21:22

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.