Matlab - matrix with blank space

  • Context: MATLAB 
  • Thread starter Thread starter Suvadip
  • Start date Start date
  • Tags Tags
    Matlab Matrix Space
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
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.

.