How to empty cell array?

19 views (last 30 days)
Mohammed
Mohammed on 22 May 2013
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?

Accepted Answer

the cyclist
the cyclist on 22 May 2013
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 = {}
  2 Comments
Matt J
Matt J on 22 May 2013
Edited: Matt J on 22 May 2013
Or, depending on what's needed,
c(:) = {[]};
Mohammed
Mohammed on 23 May 2013
Thanks a lot

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!