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

11 次查看(过去 30 天)
what is the difference between A=[]; and A={}; ?

采纳的回答

dbmn
dbmn 2016-11-18
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 个评论
Kanwal Kaur
Kanwal Kaur 2016-11-18
means A=[] can store only double values??
dbmn
dbmn 2016-11-18
no. You can still do things like:
>> A=[];
>> A{2}='asdf';
>> class(A)
ans =
cell
without encountering an error

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by