replacing items in a matrix
2 views (last 30 days)
Show older comments
CLARK KENDRICK GO
on 8 Apr 2018
Answered: Walter Roberson
on 8 Apr 2018
I have a vector:
A = 6:2:19;
and
r = 10;
I want to replace the element in A which corresponds to r with nothing.
So I want my new vector A = [6, 8, 12, 14, 16, 18];
How do I do that?
0 Comments
Accepted Answer
Walter Roberson
on 8 Apr 2018
A(A==r) = [];
If r is a vector or array then
A(ismember(A,r)) = [];
0 Comments
More Answers (1)
Sumit Chaudhary
on 8 Apr 2018
clc; clear all; close all;
A = 6:2:19; r = 10;
A1 = A(find(A~=r))
0 Comments
See Also
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!