MATLAB: Kvalue=zer​os(size(da​ta,1),size​(data,1),s​ize(data,2​));

MATLAB

i have following codes for compute of kernel foe fuzzy cmeans based on kernel or kfc :
function kvalue=compute_kvalue(data)
v=6.1;
var = (max(data)-min(data)).^2/v;
kvalue=zeros(size(data,1),size(data,1),size(data,2));
for i=1:size(data,1)
for j=i:size(data,1)
kvalue(i,j,:)=exp(-abs(data(i,:)-data(j,:)).^2./var);
kvalue(j,i,:)=kvalue(i,j,:);
end
end
end
line 4 ,what means?

Best Answer

kvalue=zeros(size(data,1),size(data,1),size(data,2));
The above line is just initializing an array of zeros that has dimensions MxMxN where M is the number of rows in data and N is the number of columns.
So that,
data = randn(8,4);
kvalue=zeros(size(data,1),size(data,1),size(data,2));
kvalue is a matrix of zeros that is 8x8x4. The matrix of zeros is then filled with values in the following for loop.
Related Question