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

 채택된 답변

dbmn
dbmn 2016년 11월 18일

0 개 추천

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??
no. You can still do things like:
>> A=[];
>> A{2}='asdf';
>> class(A)
ans =
cell
without encountering an error

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2016년 11월 18일

댓글:

2016년 11월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by