How to split into different tables a multi-level cell?
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
0 votes
Share a link to this question
Accepted Answer
12 Comments
- "it creates a 242x11 table" thus the two lines of code do what they are supposed to do
- "what I am doing wrong" I cannot see any requirement besides "242x11 table" and that is fulfilled. What do you further require? What do you want to achieve? You don't say.


- it attempts to create a cell array, data, which differs from data that you uploaded in the mat-file. E.g. MeanR ... in the uploaded data are scalars, here they are vectors with one element per seed.
- In the uploaded data the format of the first row didn't differ from the rest. It might be a good idea to show column headers in the first row, e.g. ...,'MeansR','MeansG','MeansB','Areas','Length','Width',...
- this construct is inefficient and hard to read. The numbers of files is known, thus pre-allocating the cell array, data = cell( nfiles, 12 );, and use assignments to fill it with data.
- When the outer loop encounters a picture with fewer seeds than the previous the values at the end of Areas etc. will not be overwritten. The length of Areas etc. will increase down the table. Pictures with few seeds will give entries in the table with data on seeds of previous pictures.
- pre-allocation of memory is a good habit.
- The generic names, e.g. Length, make me nervous. There is a risk, they are in conflict with names used by Matlab.
- I have problems with the blip as a shortcut for transpose. I prefer reshape, because the name is good and reshape outputs the desired shape regardless of whether the input is row or column.
- I removed some help-variables, which I didn't think added any value.
- I vectorized the loops over numSeeds.
- I removed the crop-command to simplify testing.
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!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: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)