MATLAB Answers

How to emtpy part of a matrix?

1 view (last 30 days)
Terek Li
Terek Li on 17 Oct 2016
Commented: Terek Li on 17 Oct 2016
If I have a matrix like this :
a = [1 2; 3 4; 5 6; 7 8]
is there a quick way to remove '3' and '4' from the matrix so it looks like :
a = [1 2; [] 4; [] 6; 7 8]?
I only want to remove value in the 1st column starting on the 2nd row and ending at the 2nd last row.
THANKS!

  0 Comments

Sign in to comment.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 17 Oct 2016
a = [1 2; 3 4; 5 6; 7 8];
a(2:3,1) = nan;

  1 Comment

Terek Li
Terek Li on 17 Oct 2016
perfect, thanks!

Sign in to comment.

More Answers (0)


Translated by