I've been looking for the same thing and have grown pretty frustrated with this having to create temporary variables or loops all over the place for a long time. Thank you @Jan to have clarified that there is no better option.
I'd love somebody's input on these: I want the second component of the Centroid of the structure given by the regionprops function.
My wishful thinking would be this working
idx = [1,10,55,832];
XCentroids = vertcat(RegionPropsOut(idx).Centroid(2));
Expected one output from a curly brace or dot indexing expression,
but there were 4 results.
but yeah, this doesn't work. So I thought for years there might be a some notation like
XCentroids = vertcat(RegionPropsOut(idx).Centroid)(:,2);
but sure, there is nothing like the "appended parenthesis idea".
There is also no other one-liner that might do it, right.... this would be another idea but no
[~, XCentroid] = vertcat(RegionPropsOut(idx).Centroid);
Error using vertcat
Too many output arguments.
Is there really no nicer way? Instead of looping I still prefer the also ugly temporary variable like such...
tmp = vertcat(stats1.Centroid);
XCentroid = tmp(:,2);
this is one of the annoyances I encounter far too often. I'd appreciate an idea to make this nicer and less memory intensive.