image thumbnail

Mathworks Rubik version 2

by

 

04 Apr 2013 (Updated )

Display, tester and solver of the Rubik's game, including "full cubes".

Cube=FindRubikCube
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