MATLAB: How to empty cell array

empty cell array

Hi all
How to empty cell array?
I have a problem that every loop results overwrite the one before so I am trying to empty the cell array every loop so when it comes to successive loop the previous results not interfering the last results. Any help?

Best Answer

It will depend on exactly what you mean by "empty", but if your cell array is named c, then this command
c(:) = []
will make c into an empty cell array, and so will
c = {}