From: us on
On Jul 26, 3:06 pm, "Ashok1288 kumar" <asok1...(a)gmail.com> wrote:
> thanks what is the difference in using [] and {} in fact both denote array?
>
> Thanks

well...
ARRAY simply is the general term of a collection of objects...
in particular, ML's syntax creates these ARRAYs

ca={'a',1,magic(3)}
% CA is an ARRAY of CELLs
da=[1:5,100,1000:1010]
% DA is an ARRAY of DOUBLEs, ie, usually also referred to as vector/
matrix...
whos ca da;

us
From: Andy on
"Ashok1288 kumar" <asok1288(a)gmail.com> wrote in message <i2k17t$di$1(a)fred.mathworks.com>...
> thanks what is the difference in using [] and {} in fact both denote array?
>
> Thanks

Using [] creates a double array, while using {} creates a cell array. Cell arrays are meant to hold multiple types of data, not just numbers. So it doesn't always make sense to sum over the elements of a cell array.

You should read the Getting Started section of the documentation to learn how to work with different types of arrays.
From: Steve Amphlett on
"Ashok1288 kumar" <asok1288(a)gmail.com> wrote in message <i2k17t$di$1(a)fred.mathworks.com>...
> thanks what is the difference in using [] and {} in fact both denote array?
>
> Thanks

[] is from the old days when everything in Matlab was a 2-D double-precision matrix.

In recent years, other data types have appeared along with structures, cell arrays and other methods of storing the types. These have various new syntaxes, {} bing the one for what are called "cell arrays".

Of course the original [] arrays are still perfectly valid and probably the best way to get started.