MATLAB: Clearing part of an array

cell arrays

I'm having a tough time figuring out the syntax to access specific columns in an array (and maybe even using the wrong terms to describe this…).
Say data=1×16 cell. If I want to clear the data but keep the columns intact, I have been doing data{1,8}={} and that clears column 1-8. However, I can not do data{9,16}={} to clear 9-16.
How would I do this? I'm sure it's something simple I am overlooking…

Best Answer

Since data is a row of cells, the syntax
data{1,8} = {}
actually sets the 8th entry of data equal to the empty cell. To set each of the first eight entries of data equal to the empty cell, you can use
data(1:8) = {[]}
Similarly, clear the data in entries 9 through 16 using the syntax
data(9:16) = {[]}