Borrar filtros
Borrar filtros

what is the difference between A=[]; and A={}; ?

7 visualizaciones (últimos 30 días)
Kanwal Kaur
Kanwal Kaur el 18 de Nov. de 2016
Comentada: dbmn el 18 de Nov. de 2016
what is the difference between A=[]; and A={}; ?

Respuesta aceptada

dbmn
dbmn el 18 de Nov. de 2016
One initializes the variable as a double (or array of doubles) and the other as a cell (or a cell array)
>> A=[];
>> class(A)
ans =
double
and
>> B={};
>> class(B)
ans =
cell
  2 comentarios
Kanwal Kaur
Kanwal Kaur el 18 de Nov. de 2016
means A=[] can store only double values??
dbmn
dbmn el 18 de Nov. de 2016
no. You can still do things like:
>> A=[];
>> A{2}='asdf';
>> class(A)
ans =
cell
without encountering an error

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by