Borrar filtros
Borrar filtros

what will this code will perform ? Numclass=[]; for i = 1:nclass Classes=da​ta.y(find(​data.y==i)​); if size(Classes) ~=0 Numclass = [Numclass; Classes(1)]; end end

2 visualizaciones (últimos 30 días)
Numclass=[];%empty vector array for i = 1:nclass Classes=data.y(find(data.y==i));%Find indices and values of nonzero elements if size(Classes) ~=0 Numclass = [Numclass; Classes(1)]; end end

Respuesta aceptada

KSSV
KSSV el 18 de Nov. de 2016
clc ; clear all ;
Numclass=[]; % assigning a vairable, to append data later
for i = 1:nclass % nclass will be a number
Classes=data.y(find(data.y==i)); % data is a structure, from this data.y for i ispicked
if size(Classes) ~=0 % is Classes is not zero, append it to Numclass
Numclass = [Numclass; Classes(1)];
end
end
From where you are getting this? You must have some idea on what you are doing. If it is a existing code, this is not the way to understand.
  1 comentario
Kanwal Kaur
Kanwal Kaur el 18 de Nov. de 2016
My teacher has given me this code, she has told me to understand it well.As i am new to MATLAB, not able to understand whole well.So, asking for online help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by