Extract values from matrix/cell in single step
Show older comments
I'm sure there's a nice way of doing this in a single line, just haven't found the right syntax... If I have a several element matrix, how can I extract values from it in one step - specifically, I'm looking to take the screensize available in X & Y...
Size = get(groot,'ScreenSize')
returns a 1x4 double, and I then can access each element as standard Matlab Matrix Indexing:
X_Size = Size(1,3);
Y_Size = Size(1,4);
I'm wanting to do something like the following, which takes the 3 lines into 1:
[Offset_1 Offset_2 X_Size Y_Size] = get(groot,'ScreenSize');
which would assign each of the 4 elements to the 4 variables in the matrix on the left. What's the best practice to do this?
Accepted Answer
More Answers (1)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!