MATLAB Answers

0

Deleting a Cell and shifting cells left

Asked by Ibro Tutic on 1 Aug 2017
Latest activity Commented on by Ibro Tutic on 1 Aug 2017
I need to remove the n-th data (in a 1xn vector) and shift over the rest of the contents to the left by one. How would I do this?
Assume we had a cell array
a = {'1' '2' '3' '4' '5' '6' '7' '8' '9'}.
We want to delete the third entry and move over all of the data.
a{3}={}
So then
a={'1' '2' '' '4' '5' '6' '7' '8' '9'}.
Move data 1 column to the left to get rid of empty space
a={'1' '2' '4' '5' '6' '7' '8' '9'}.

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Azzi Abdelmalek
on 1 Aug 2017
 Accepted Answer

a = {'1' '2' '3' '4' '5' '6' '7' '8' '9'}
a(3)=[]

  1 Comment

Much easier than I thought, perfect.

Sign in to comment.