CELL2MAT error in version 2015a
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Walter Roberson
2015년 9월 15일
0 개 추천
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')
카테고리
도움말 센터 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!