Vertically concatenate a 2 column comma separated list
1 次查看(过去 30 天)
显示 更早的评论
I have a structure of size 100 extracted from regionprops called stat. Id like to extract the column of data that stores the centroids of each component. Since they are in a list, I tried
centroids = [stat(:).Centroid]';
but it gives me an array of size 200 meaning it doesnt concatenate properly. Then I tried
x = [stat(:).Centroid(1)];
y = [stat(:).Centroid(2)];
but I get an error "Scalar index required for this type of multi-level indexing". Id like the result to be an array of 100 rows and 2 columns. Can someone suggest what I can do ? This is so difficult.
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!