Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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 ??

Answers (1)

Chad Greene
Chad Greene on 18 Mar 2014
Is Label_size defined before this bit of code?
  1 Comment
pooja
pooja on 18 Mar 2014
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!