CELL2MAT error in version 2015a
Mostrar comentarios más antiguos
I'm currently using a modified version of the ginput2.m function from the code exchange but I'm recieving the following error when I select more than 2 points:
hlastaxes = cell2mat(hlastaxes)
CELL2MAT does not support cell arrays containing cell arrays or objects.
The funtion tries to redraw the last point selected via:
x0 = []; y0 = []; z0 = [];
inan = isnan([NaN; X; NaN])
if ~inan(end-1)
inan = find(inan);
nlastpoints = inan(end)-inan(end-1)-1
npoints = length(hpoints)
range = npoints-nlastpoints+1:npoints
hlastaxes = get(hpoints(range),'Parent');
assignin( 'base', 'hlastaxes', hlastaxes );
if iscell(hlastaxes), hlastaxes = cell2mat(hlastaxes); end
[loc,loc] = ismember(ha,hlastaxes);
if loc
x0 = get(hpoints(range(loc)),'XData');
y0 = get(hpoints(range(loc)),'YData');
z0 = get(hpoints(range(loc)),'ZData');
end
end
This worked fine in version 2014b, which would normally return a series of axes objects as numbers rather than a data array when using get( hpoints(range), 'Parent' ). Is there a simple fix to found out if the parent axes of that point is a member of the current axes?
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 15 de Sept. de 2015
0 votos
We need more information about the construction of hpoints.
As of R2014b, graphics objects are handles to objects, and certain operations that formerly worked to construct arrays that mixed graphics object double handles with other values in a cell array can now end up returning nested cell arrays instead. (I had it happen with one program; I have not hunted down the fix yet.)
To determine the axes that a point belongs to, use ancestor(ThePoint,'axes')
Categorías
Más información sobre Data Exploration en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!