function varargout = CellTracking_GUI_Trajectory(varargin) % CELLTRACKING_GUI_TRAJECTORY M-file for CellTracking_GUI_Trajectory.fig % CELLTRACKING_GUI_TRAJECTORY, by itself, creates a new CELLTRACKING_GUI_TRAJECTORY or raises the existing % singleton*. % % H = CELLTRACKING_GUI_TRAJECTORY returns the handle to a new CELLTRACKING_GUI_TRAJECTORY or the handle to % the existing singleton*. % % CELLTRACKING_GUI_TRAJECTORY('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in CELLTRACKING_GUI_TRAJECTORY.M with the given input arguments. % % CELLTRACKING_GUI_TRAJECTORY('Property','Value',...) creates a new CELLTRACKING_GUI_TRAJECTORY or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before CellTracking_GUI_Trajectory_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to CellTracking_GUI_Trajectory_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help CellTracking_GUI_Trajectory % Last Modified by GUIDE v2.5 17-May-2012 17:33:29 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @CellTracking_GUI_Trajectory_OpeningFcn, ... 'gui_OutputFcn', @CellTracking_GUI_Trajectory_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before CellTracking_GUI_Trajectory is made visible. function CellTracking_GUI_Trajectory_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no opst args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to CellTracking_GUI_Trajectory (see VARARGIN) % Choose default command line output for CellTracking_GUI_Trajectory handles.output = hObject; handles.p=varargin{1};% path of the raw data handles.ti=varargin{2};% Time interval between adjacent frames (s) handles.pi=varargin{3};% image size(pixel) p=get(handles.p,'String'); ti=str2double(get(handles.ti,'String')); % frames p=[p,'\'];% the oral data filename=dir([p '*.xlsx']);% the name of oral name % data, da: only num, txt: only string, raw: num+string [da,txt,raw]=xlsread([p filename(1).name],'Sheet1'); [m T]=size(raw); % Parameters (f: frame) % Distance(f-1);Acc.Dist(f);X Coord(f);Y Coord(f);Angle(f-1) % Or.Dist(f);Velocity(f-1);Area(polygon)(f);Aspect(f) % m-2=3*(f-1)+6*f f=round((m+1)/9); set(handles.f,'String',num2str(f)); % the normal state :frame range from first to the last set(handles.frrg1,'String','1'); set(handles.frrg2,'String',num2str(f)); % marker set(handles.shape,'Value',12); set(handles.marsize,'Value',1); set(handles.marcolor,'Value',1); set(handles.linestyle,'Value',1); set(handles.linewidth,'Value',2); set(handles.linecolor,'Value',2); % output style is set to movie set(handles.opst,'Value',1); % the oral frame rate is'30min-->30s'and display set(handles.frc,'Value',1.0); frc=60/ti; set(handles.fratec,'String',num2str(frc)); % image set(handles.imformat,'Value',1); set(handles.frnu,'String',num2str(f)); % Update handles structure guidata(hObject, handles); % UIWAIT makes CellTracking_GUI_Trajectory wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = CellTracking_GUI_Trajectory_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning opst args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line opst from handles structure varargout{1} = handles.opst; % --- Executes on selection change in opst. function opst_Callback(hObject, eventdata, handles) % hObject handle to opst (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns opst contents as cell array % contents{get(hObject,'Value')} returns selected item from opst % --- Executes during object creation, after setting all properties. function opst_CreateFcn(hObject, eventdata, handles) % hObject handle to opst (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in refresh. function refresh_Callback(hObject, eventdata, handles) % hObject handle to refresh (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) p=get(handles.p,'String'); p=[p,'\'];% the place of oral data filename=dir([p '*.xlsx']);% the name of oral data if(isempty(struct2cell(filename)))==1 %when the place is wrong,the excel isnot exist,giving a waring warndlg('The path is incorrect!','Warning') else % data, da: only num, txt: only string, raw: num+string [da,txt,raw]=xlsread([p filename(1).name],'Sheet1'); [m T]=size(raw); % Parameters (f: frame) % Distance(f-1);Acc.Dist(f);X Coord(f);Y Coord(f);Angle(f-1) % Or.Dist(f);Velocity(f-1);Area(polygon)(f);Aspect(f) % m-2=3*(f-1)+6*f f=round((m+1)/9); set(handles.f,'String',num2str(f));% frames set(handles.frrg2,'String',num2str(f));% frame range from the first to the last set(handles.frnu,'String',num2str(f));% frame number is the last frame end % Update handles structure guidata(hObject, handles); % --- Executes on button press in trajectory. function trajectory_Callback(hObject, eventdata, handles) % hObject handle to trajectory (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % excel:the oral data should have the same name to the image name p=get(handles.p,'String'); p=[p,'\'];% the oral data filename=dir([p '*.xlsx']);% the name of oral data if(isempty(struct2cell(filename)))==1 %when the place is wrong,the excel isnot exist,giving a waring warndlg('The path is incorrect!','Warning') else frrg1=str2num(get(handles.frrg1,'String'));% frame range frrg2=str2num(get(handles.frrg2,'String')); frnu=str2num(get(handles.frnu,'String'));% frame number opst=get(handles.opst,'Value');% output style if opst<3 js=frrg1; je=frrg2; else js=frnu; je=frnu; if (frnufrrg2) % when output style is specific frame and the frame number is out of % the frame range£¬giving a waring warndlg('The frame number is out of frame range!','Warning'); return; end end % if isdir([p,'data']) if isdir([p,'data\trajectory']) pn=[p,'data\'];% the data to save pt=[pn,'trajectory\'];% movie to save else pn=[p,'data\'];% the data place mkdir(pn,'trajectory');% set up the trajectory to save the movie pt=[pn,'trajectory\'];% the movie's place end else mkdir(p,'data');% set up the floder data to save the results and figures pn=[p,'data\'];% the data save path mkdir(pn,'trajectory');% set up the trajectory to save movie pt=[pn,'trajectory\'];% the path of movie end % parameters: pi- image marsize(pixel);lim- xlim and ylim for plotted raw trajectory pi=str2num(get(handles.pi,'String')); limx=[1 pi(1)]; limy=[1 pi(2)]; lf=length(filename);% the number of sample % get the name of sample dname=cell(1,lf); for i=1:lf dname(i)=cellstr(filename(i).name(1:(length(filename(i).name)-5))); end % choose sample£ºv=0 represent no choose or cancel; v=1 means choose and ok [s,v]=listdlg('PromptString','Select samples:',... 'SelectionMode','multiple',... 'ListString',dname); if v==1 % shv=get(handles.shape,'Value');%12 are none sh=get(handles.shape,'String'); if shv==12 sh=''; else sh=sh{shv}(1); end msv=get(handles.marsize,'Value'); ms=get(handles.marsize,'String'); ms=str2num(ms{msv}); mcv=get(handles.marcolor,'Value');%1 means random mc=get(handles.marcolor,'String'); mc=mc{mcv}(1); lsv=get(handles.linestyle,'Value');%5 means none ls=get(handles.linestyle,'String'); if lsv==5 ls=''; else ls=ls{lsv}(1:2); end lwv=get(handles.linewidth,'Value'); lw=get(handles.linewidth,'String'); lw=str2num(lw{lwv}); lcv=get(handles.linecolor,'Value');%1 means random lc=get(handles.linecolor,'String'); if lcv==1 lc=''; else lc=lc{lcv}(1); end % plot property if ((isempty(ls))&&(isempty(sh)==0)) prt1=[ls,lc,sh]; prt2=[ls,lc,sh]; else prt1=[lc,'.']; prt2=[ls,lc,sh]; end for i=1:length(s) figure; if get(handles.mergedtra,'Value')==1.0 if isdir([p,dname{s(i)}]) pim=[p,dname{s(i)},'\']; filenameim=dir([pim '*.tif']); else close gcf; warndlg(['The raw images of sample ',dname{s(i)},' do not exist!'],'Warning'); continue; end end % data, da: only num, txt: only string, raw: num+string [dao,txt,raw]=xlsread([p filename(s(i)).name],'Sheet1'); [m T]=size(raw); da=NaN(m,(T-1)); [da1 da2]=size(dao); da(1:da1,1:da2)=dao; % Parameters (f: frame) % Distance(f-1);Acc.Dist(f);X Coord(f);Y Coord(f);Angle(f-1) % Or.Dist(f);Velocity(f-1);Area(polygon)(f);Aspect(f) % m-2=3*(f-1)+6*f f=round((m+1)/9); % Trajectory (pixel); Mean displacement (um); Motility coefficient (um^2/min) x=da((2+2*f):(3*f+1),:);% X Coord y=da((2+3*f):(4*f+1),:);% Y Coord if je>f je=f; end for j=js:je if opst<3 if j==js prt=prt1; else prt=prt2; end plot(x(js:j,:),y(js:j,:),prt,'LineWidth',lw,... 'MarkerSize',ms,'MarkerEdgeColor',mc); else if j==1 prt=prt1; else prt=prt2; end plot(x(frrg1:j,:),y(frrg1:j,:),prt,'LineWidth',lw,... 'MarkerSize',ms,'MarkerEdgeColor',mc); end axis equal set(gca,'ydir','reverse','xaxislocation','top'); set(gca, 'Color', [0 0 0]); %set the background to black set(gca,'xtick',[],'ytick',[]); set(gcf,'position',[20,20,pi(1),pi(2)]); set(gca,'Position',[0 0 1 1]); box off xlim(limx); ylim(limy); mn=j-frrg1+1; M(mn)=getframe; [tr,map]=frame2im(M(mn)); % Return associated image data if isempty(map) % Truecolor system rtra=tr; else % Indexed system rtra=ind2rgb(tr,map); % Convert image data end if get(handles.mergedtra,'Value')==1.0 im=imread([pim filenameim(j).name]); mk=rgb2gray(rtra); mk=im2bw(mk,0); mk=~mk; for mei=1:3 mk3(:,:,mei)=mk(:,:); end me=immultiply(im,mk3); me=imadd(me,rtra); else me=rtra; end if opst==1 M(mn)=im2frame(me); elseif opst==2 mkdir(pt,[dname{s(i)},'_tra_image']);% set up floder to save the image ptim=[pt,dname{s(i)},'_tra_image\']; imfv=get(handles.imformat,'Value'); imf=get(handles.imformat,'String'); imf=imf{imfv}; imwrite(me,[ptim,num2str(j,'%4.4d'),'.',imf]); else imfv=get(handles.imformat,'Value'); imf=get(handles.imformat,'String'); imf=imf{imfv}; imwrite(me,[pt,dname{s(i)},num2str(j,'%4.4d'),'.',imf]); end end if opst==1 if get(handles.frc,'Value')==1 fr=str2num(get(handles.fratec,'String')); else fr=str2num(get(handles.frateud,'String')); end movie(M,1,fr);% movie avi movie2avi(M, [pt,dname{s(i)},'.avi'],'fps',fr,'compression','None','qyality',100); else figure,imshow(me); end end end end % Update handles structure guidata(hObject, handles); function f_Callback(hObject, eventdata, handles) % hObject handle to f (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of f as text % str2double(get(hObject,'String')) returns contents of f as a double % --- Executes during object creation, after setting all properties. function f_CreateFcn(hObject, eventdata, handles) % hObject handle to f (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function frrg1_Callback(hObject, eventdata, handles) % hObject handle to frrg1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of frrg1 as text % str2double(get(hObject,'String')) returns contents of frrg1 as a double % --- Executes during object creation, after setting all properties. function frrg1_CreateFcn(hObject, eventdata, handles) % hObject handle to frrg1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function frrg2_Callback(hObject, eventdata, handles) % hObject handle to frrg2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of frrg2 as text % str2double(get(hObject,'String')) returns contents of frrg2 as a double % --- Executes during object creation, after setting all properties. function frrg2_CreateFcn(hObject, eventdata, handles) % hObject handle to frrg2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in shape. function shape_Callback(hObject, eventdata, handles) % hObject handle to shape (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns shape contents as cell array % contents{get(hObject,'Value')} returns selected item from shape % --- Executes during object creation, after setting all properties. function shape_CreateFcn(hObject, eventdata, handles) % hObject handle to shape (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in marsize. function marsize_Callback(hObject, eventdata, handles) % hObject handle to marsize (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns marsize contents as cell array % contents{get(hObject,'Value')} returns selected item from marsize % --- Executes during object creation, after setting all properties. function marsize_CreateFcn(hObject, eventdata, handles) % hObject handle to marsize (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in marcolor. function marcolor_Callback(hObject, eventdata, handles) % hObject handle to marcolor (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns marcolor contents as cell array % contents{get(hObject,'Value')} returns selected item from marcolor % --- Executes during object creation, after setting all properties. function marcolor_CreateFcn(hObject, eventdata, handles) % hObject handle to marcolor (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in linestyle. function linestyle_Callback(hObject, eventdata, handles) % hObject handle to linestyle (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns linestyle contents as cell array % contents{get(hObject,'Value')} returns selected item from linestyle % --- Executes during object creation, after setting all properties. function linestyle_CreateFcn(hObject, eventdata, handles) % hObject handle to linestyle (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in linewidth. function linewidth_Callback(hObject, eventdata, handles) % hObject handle to linewidth (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns linewidth contents as cell array % contents{get(hObject,'Value')} returns selected item from linewidth % --- Executes during object creation, after setting all properties. function linewidth_CreateFcn(hObject, eventdata, handles) % hObject handle to linewidth (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in linecolor. function linecolor_Callback(hObject, eventdata, handles) % hObject handle to linecolor (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns linecolor contents as cell array % contents{get(hObject,'Value')} returns selected item from linecolor % --- Executes during object creation, after setting all properties. function linecolor_CreateFcn(hObject, eventdata, handles) % hObject handle to linecolor (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes when selected object is changed in moviefr. function moviefr_SelectionChangeFcn(hObject, eventdata, handles) % hObject handle to the selected object in moviefr % eventdata structure with the following fields (see UIBUTTONGROUP) % EventName: string 'SelectionChanged' (read only) % OldValue: handle of the previously selected object or empty if none was selected % NewValue: handle of the currently selected object % handles structure with handles and user data (see GUIDATA) switch get(hObject,'String') % Get Tag of selected object case '30 min -->30s' set(handles.frateud,'String',''); % the movie of real time 30min is played 30 s ti=str2double(get(handles.ti2,'String')); frc=60/ti; set(handles.fratec,'String',num2str(frc)); case 'User-defined' set(handles.fratec,'String',''); frateud=str2num(get(handles.frateud,'String')); % if (isempty(frateud)) % warndlg: input the frame rate warndlg('Please input the user-defined frame rate!','Warning'); end otherwise end % Update handles structure guidata(hObject, handles); function fratec_Callback(hObject, eventdata, handles) % hObject handle to fratec (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of fratec as text % str2double(get(hObject,'String')) returns contents of fratec as a double % --- Executes during object creation, after setting all properties. function fratec_CreateFcn(hObject, eventdata, handles) % hObject handle to fratec (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function frateud_Callback(hObject, eventdata, handles) % hObject handle to frateud (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of frateud as text % str2double(get(hObject,'String')) returns contents of frateud as a double % --- Executes during object creation, after setting all properties. function frateud_CreateFcn(hObject, eventdata, handles) % hObject handle to frateud (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on selection change in imformat. function imformat_Callback(hObject, eventdata, handles) % hObject handle to imformat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns imformat contents as cell array % contents{get(hObject,'Value')} returns selected item from imformat % --- Executes during object creation, after setting all properties. function imformat_CreateFcn(hObject, eventdata, handles) % hObject handle to imformat (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function frnu_Callback(hObject, eventdata, handles) % hObject handle to frnu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of frnu as text % str2double(get(hObject,'String')) returns contents of frnu as a double % --- Executes during object creation, after setting all properties. function frnu_CreateFcn(hObject, eventdata, handles) % hObject handle to frnu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end