I am trying to create a loop that will output an array of file names so that I can easily import into Excel. The files are distinguished by the last number only.

You are watching: Cell contents assignment to a non cell array object






cool, it works when I place that "clearvars" in beginning of code. Thanks so much. BTW, what"s exactly meaning of clearvars???


The difficulty is that you had an existing variable named filename that was not a cell array. You had to either get rid of the variable by clearing it, or you had to make it a cell array such as with

Community Treasure Hunt

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

Start Hunting!
An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web site

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other bromheads.tv country sites are not optimized for visits from your location.

See more: How Can Activities Such As Yoga And Meditation Serve As Alternatives To Drug Use?


Accelerating the pace of engineering and science

bromheads.tv is the leading developer of mathematical computing software for engineers and scientists.