MATLAB Answers

removing specific rows from char array

4 views (last 30 days)
sermet OGUTCU
sermet OGUTCU on 27 Aug 2021
Commented: the cyclist on 27 Aug 2021
data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
How I can remove the 1st and 5th columns from data aray?
  1 Comment
the cyclist
the cyclist on 27 Aug 2021
data is a 10x2 character array, so it does not have a 5th column. I assume you meant row. See my solution.

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 27 Aug 2021
data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
data([1 5],:) = []
data = 8×2 char array
'02' '03' '04' '06' '07' '08' '09' '10'
  2 Comments
the cyclist
the cyclist on 27 Aug 2021
data=['01'; '02'; '03'; '04'; '05'; '06'; '07'; '08'; '09'; '10'];
remove = [1 5];
data(remove,:) = []
data = 8×2 char array
'02' '03' '04' '06' '07' '08' '09' '10'
This is a very basic MATLAB question. You might benefit from watching the MATLAB Onramp tutorial.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!