image thumbnail
from Mathworks Rubik by Stijn Helsen
Display, tester and solver of the Rubiks game, including "full cubes".

Cube=FindRubikCube %FindRubikAxes - Find a Rubik-cube if isempty(findobj('Type','figure')) error('No figures available') end f=gcf; hAxes=[]; if strcmp(get(f,'Tag'),'RubikFigure') ca=get(f,'CurrentAxes'); if strcmp(get(ca,'Tag'),'RubikAxes') hAxes=c
function Cube=FindRubikCube
%FindRubikAxes - Find a Rubik-cube

if isempty(findobj('Type','figure'))
	error('No figures available')
end
f=gcf;
hAxes=[];
if strcmp(get(f,'Tag'),'RubikFigure')
	ca=get(f,'CurrentAxes');
	if strcmp(get(ca,'Tag'),'RubikAxes')
		hAxes=ca;
	else
		hAxes=findobj(f,'Tag','RubikAxes');
		if isempty(hAxes)
			error('Can''t find the right axes in this figure')
		elseif length(hAxes)>1
			error('Can''t select the right axes in this figure!')
		end
	end
end
if isempty(hAxes)
	hAxes=findobj('Tag','RubikAxes');
	if isempty(hAxes)
		error('Cann''t find any Rubik axes');
	elseif length(hAxes)>1
		error('Can''t select the right axes!!')
	end
end
Cube=get(hAxes,'UserData');

Contact us at files@mathworks.com