Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Colon with empty input

Subject: Colon with empty input

From: Bruno Luong

Date: 27 Jan, 2013 08:45:08

Message: 1 of 5

>> 1:[]

ans =

   Empty matrix: 1-by-0

Does this is documented?

Subject: Colon with empty input

From: Greg Heath

Date: 27 Jan, 2013 12:15:08

Message: 2 of 5

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ke2pek$b95$1@newscl01ah.mathworks.com>...
> >> 1:[]
>
> ans =
>
> Empty matrix: 1-by-0
>
> Does this is documented?

Get same results from

[]:[], []:0, []:1, 0:[], 1:[], 1:0

Greg

Subject: Colon with empty input

From: Bruno Luong

Date: 27 Jan, 2013 12:44:08

Message: 3 of 5

Also from

1:[]:2

Bruno

Subject: Colon with empty input

From: Steven_Lord

Date: 28 Jan, 2013 15:31:10

Message: 4 of 5



"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message
news:ke2pek$b95$1@newscl01ah.mathworks.com...
>>> 1:[]
>
> ans =
>
> Empty matrix: 1-by-0
>
> Does this is documented?

It doesn't appear to be; I'll ask the documentation staff to add it. I
believe the rule is that if any of the three arguments of the : operator are
empty, the result should be a 1-by-0 empty.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Colon with empty input

From: Loren Shure

Date: 28 Jan, 2013 16:17:42

Message: 5 of 5


"Steven_Lord" <slord@mathworks.com> wrote in message
news:ke65jv$l79$1@newscl01ah.mathworks.com...
>
>
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message
> news:ke2pek$b95$1@newscl01ah.mathworks.com...
>>>> 1:[]
>>
>> ans =
>>
>> Empty matrix: 1-by-0
>>
>> Does this is documented?
>
> It doesn't appear to be; I'll ask the documentation staff to add it. I
> believe the rule is that if any of the three arguments of the : operator
> are empty, the result should be a 1-by-0 empty.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

It may not be explicitly documented, but the : operator outputs a row
vector, size 1xN. The empty row vector has size 1x0.


--
Loren
http://blogs.mathworks.com/loren/
http://www.mathworks.com/matlabcentral/

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us