Unpacking and tabulating contents of a cell array
16 次查看(过去 30 天)
显示 更早的评论
Hi, I have the following cell array:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/543601/image.png)
My goal is to unpack the contents of each cell and tabulate the amount of times each number occurs. My first attempt below unpacks each cell in the command window and only the final 25th cell in the workspace under 'ans':
vsel{:}
My second attempt only returns the 1st of 25 cells in a new array in the workspace:
h = size(vsel,1);
vsel = vsel{1:h,1};
My third attempt was to use a comma separated list and employ concatenation but that only appears to work on arrays where each cell is of the same dimensions:
matrix = vertcat(vsel{:});
Once I can extract this information, I plan on tabulating the amount of times each number appears in each cell. Any help would be greatly appreciated!
-Ryan
3 个评论
Walter Roberson
2021-3-9
In the posted data, the entries are all sorted and no entry occurs more than once per cell. Are those characteristics that can be counted on?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!