Info

この質問は閉じられています。 編集または回答するには再度開いてください。

type of variable "m" changes (i.e int or [ ] ) while running a program using different datasets

1 回表示 (過去 30 日間)
pooja
pooja 2014 年 3 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
when i use a dataset : values of m,n,temp are integer and, i get results
but, when i use another dataset as input : value of m becomes an empty array [] , i cant figure out how ??
here the code
rankloss=0;
for i=1:num_instance
temp=0;
for m=1:Label_size(i)
for n=1:(num_class-Label_size(i))
if(Outputs(Label{i,1}(m),i)<=Outputs(not_Label{i,1}(n),i))
temp=temp+1;
end
end
end
*rl_binary(i)=temp/(m*n);
rankloss=rankloss+temp/(m*n);*
end
Label_size=zeros(1,num_instance); and
[num_class,num_instance]=size(Outputs); here.
so as a result i get this error
Error using / : Matrix dimensions must agree: temp/(m*n); (because m is [] )
i tried temp./(m.*n) but it obviously gives an empty array [] as a reult
note: both input datasets have same dimensions and same type , only data differs
i hoep my question is clear .... how can i figure out why m becomes [ ] instead of an integer value ??

回答 (1 件)

Chad Greene
Chad Greene 2014 年 3 月 18 日
Is Label_size defined before this bit of code?
  1 件のコメント
pooja
pooja 2014 年 3 月 18 日
yes Mr.Chad Greene i have specified in my question (sorry 4 that gray text in it )
Label_size=zeros(1,num_instance); and
[num_class,num_instance]=size(Outputs); here.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by