Matlab - matrix with blank space

  • Context: MATLAB 
  • Thread starter Thread starter Suvadip
  • Start date Start date
  • Tags Tags
    Matlab Matrix Space
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Suvadip
Messages
68
Reaction score
0
r=zeros(1,6);
r(1,2:4)=2;
r(1,5)= -

rfor the above program,

I want the output as

r=

0 2 2 2 - 0

how to do this in matlab? please help
 
Physics news on Phys.org
suvadip said:
r=zeros(1,6);
r(1,2:4)=2;
r(1,5)= -

rfor the above program,

I want the output as

r=

0 2 2 2 - 0

how to do this in matlab? please help

cell array.

.