Info

This question is closed. Reopen it to edit or answer.

Using get() with cell array

1 view (last 30 days)
Eric Haavind-Berman
Eric Haavind-Berman on 26 Jan 2016
Closed: MATLAB Answer Bot on 20 Aug 2021
I am having trouble using the get function while trying to make a simple gui. An example of the problem that I am having is below:
array = [{'a'},{'b'},{'c'}];
new_array = get(array)
Running this code gives the error: "Error using get Conversion to double from cell is not possible"
I know this is a simple question, but why would get() be trying to turn the cell array into a double and is there a way around this?

Answers (1)

Walter Roberson
Walter Roberson on 27 Jan 2016
What would the intended meaning of that be?
The first argument to get() must be a handle or array of handles. In MATLAB R2014a and earlier, graphics handles are represented as double so MATLAB would attempt to convert the cell array into a double that represents a handle.
If you want to get multiple properties of an object, then you can specify a cell array of strings as the property names, but you still need to specify the handle, such as
get(0, {'Children', 'DefaultFigurePosition'})

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!