How to initialize a cell with all zero values in matlab?

4 visualizaciones (últimos 30 días)
Roshni gupta
Roshni gupta el 16 de Jun. de 2017
Editada: Stephen23 el 16 de Jun. de 2017
I want a cell array charstring whose every cell is initialized with {000000}. I tried using
charstring={0 0 0 0 0 0 };
but its not working.

Respuestas (1)

KSSV
KSSV el 16 de Jun. de 2017
Editada: KSSV el 16 de Jun. de 2017
charstring={'0' '0' '0' '0' '0' '0'};
Or
charstring = [repmat({'0'},1,6)] ;
  2 comentarios
Stephen23
Stephen23 el 16 de Jun. de 2017
Editada: Stephen23 el 16 de Jun. de 2017
@KSSV: you might want to think about this a bit more (or actually try it):
charstring = {[repmat('0',1,6]};
Perhaps you really meant to write:
charstring = repmat({'0'},1,6);
KSSV
KSSV el 16 de Jun. de 2017
Yes..you are right.....edited the answer....

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by