I want to generate a dummy for my dataset. I have a (48x1 cell called category)
dummy=[];
for i=1:1:48
if isequal(category(i), 'Beef & Pork')
dummy(i)=1
else
dummy(i)=0
end
end

 Respuesta aceptada

Guillaume
Guillaume el 28 de Jun. de 2018

1 voto

dummy = strcmp(category, 'beef & Pork')

Más respuestas (0)

Categorías

Más información sobre Data Types en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Jun. de 2018

Comentada:

el 28 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by