image thumbnail

Mathworks Rubik version 2

by

 

04 Apr 2013 (Updated )

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

hAxes=FindRubikAxes(f)
function hAxes=FindRubikAxes(f)
%FindRubikAxes - Find a Rubik-axes
%    hAxes=FindRubikAxes[(f)]

if isempty(findobj('Type','figure'))
	error('No figures available')
end
if nargin==0
	f=gcf;
end
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

Contact us