No BSD License  

Highlights from
Tab and subtabs

image thumbnail
from Tab and subtabs by Micha³ Steuden
Tab with subtabs and deeper

hideorshowcontrols(value,turn);
function hideorshowcontrols(value,turn);
%This function turns on or turns off controls with the specified
%value in the 'UserData'.
%Place his function in your figure.m and insert the numbers in 
%uicontrols section ('Userdata') which will indicate connections
%between tabs. Click on uicontrol>>Property Inspector>>Userdata>>set value
%EXAMPLE:
%to turn off desired controls with the 'UserData'=[22; 213 ;25 ;214; 217; 2]
%turn off all uicontrols with '2' :        hideorshowcontrols(2,'off');  
%turn off all uicontrols with '21':        hideorshowcontrols(21,'off');
%turn off only uicontrol '213'    :        hideorshowcontrols(213,'off');
%turn on only '2'                 :        hideorshowcontrols(20,'on');
%turn on all except '22' and '2'  :        hideorshowcontrols([21 25],'on');
%
%Author: Micha Steuden 
%
    
    
    controlfind=findall(gcf,'Type','uicontrol');
    controluserdata=get(controlfind,'Userdata');
    for r=1:length(controluserdata)
        if ~isempty(controluserdata{r})
            controluserdatatodouble(r,1)=controluserdata{r};
        else
            controluserdatatodouble(r,1)=NaN;
        end
    end
    controlfound=controlfind(istherethisvalue(value,controluserdatatodouble));
    set(controlfound,'Visible',turn);

%find values (designed up to vectors)
function logicval=istherethisvalue(value,where)
for r=1:length(value)
    magnitudediff=whatmagnitude(where)/whatmagnitude(value(r));
    where=fix(where./magnitudediff);
    logicval(:,r)=(value(r)==where);
end
if ~(r==1) logicval=(any(logicval'))'; end;

%return the  digit magnification of 10 
function numbermagnitude=whatmagnitude(value)
    value=abs(value);
    tens=ones(length(value),1)*10;
    value(value==0)=NaN;
    numbermagnitude=tens.^(fix(log10(value)));

Contact us at files@mathworks.com