Welcome to our community

Be a part of something great, join today!

matlab - matrix with blank space

suvadip

Member
Feb 21, 2013
69
r=zeros(1,6);
r(1,2:4)=2;
r(1,5)= -

r


for the above program,

I want the output as

r=

0 2 2 2 - 0

how to do this in matlab? please help
 

zzephod

Well-known member
Feb 3, 2013
134
r=zeros(1,6);
r(1,2:4)=2;
r(1,5)= -

r


for the above program,

I want the output as

r=

0 2 2 2 - 0

how to do this in matlab? please help
cell array.

.