I am using a GUI already made, it is giving error of input argument is unused. I cannot run this code due the multiple error message like this. error highlights these variable

2 views (last 30 days)
function varargout = FLIM_processing(varargin)
% FLIM_PROCESSING MATLAB code for FLIM_processing.fig
% FLIM_PROCESSING, by itself, creates a new FLIM_PROCESSING or raises the existing
% singleton*.
%
% H = FLIM_PROCESSING returns the handle to a new FLIM_PROCESSING or the handle to
% the existing singleton*.
%
% FLIM_processing('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FLIM_processing.M with the given input arguments.
%
% FLIM_processing('Property','Value',...) creates a new FLIM_processing or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before FLIM_processing_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to FLIM_processing_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 FLIM_processing
% Last Modified by GUIDE v2.5 13-Apr-2021 19:57:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @FLIM_processing_OpeningFcn, ...
'gui_OutputFcn', @FLIM_processing_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 FLIM_processing is made visible.
function FLIM_processing_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output 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 FLIM_processing (see VARARGIN)
% Choose default command line output for FLIM_processing
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes FLIM_processing wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = FLIM_processing_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output 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 output from handles structure
varargout{1} = handles.output;
%% Get the NADH Image Button
% --- Executes on button press in pushbutton1.
function read_NADH_intensity_Callback(~, ~, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskShowImage;
global nadhImageName;
global nadhFileName;
global nadhPathName;
% Get the location of the image
[nadhFileName, nadhPathName] = uigetfile('*.asc','Pick an Image');
nadhTextImage = importdata(strcat(nadhPathName,nadhFileName));
nadhTextImage(nadhTextImage > 1000) = 0;
nadhTextImage(:,245:256)=0;
maskShowImage = nadhTextImage;
nadhImageName = {nadhFileName,'NADH'};
% display the NADH image in axes1
maxIntensityValue = max(nadhTextImage(:));
minIntensityValue = min(nadhTextImage(:));
set(handles.slider3,'Max',maxIntensityValue);
set(handles.slider3,'Min',minIntensityValue);
set(handles.text19,'String',num2str(minIntensityValue));
set(handles.text20,'String',num2str(maxIntensityValue));
set(handles.text23,'String',nadhFileName);
axes(handles.axes1);
imagesc(nadhTextImage)
colormap(gray)
colorbar
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
%% Get the Mask Image Button
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global maskImage;
global nadhThreshold;
% get the image mask
maskImage = nadhTextImage;
nadhThreshold = get(handles.edit1,'String');
nadhThreshold = str2double( nadhThreshold );
maskImage(maskImage < nadhThreshold) = 0;
maskImage(maskImage~=0) = 1;
% display the mask Image axes4
axes(handles.axes4);
imagesc(maskImage)
colormap(gray)
colorbar
%% read FAD intensity image
% --- Executes on button press in readFADIntensity.
function read_FAD_intensity_Callback(hObject, eventdata, handles)
% hObject handle to readFADIntensity (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadTextImage
% Get the location of the image
global fadImageName;
global fadFileName;
global fadPathName;
[fadFileName, fadPathName] = uigetfile('*.asc','Pick an Image');
fadImageName = {fadFileName,'FAD'};
fadTextImage = importdata(strcat(fadPathName,fadFileName));
fadTextImage(fadTextImage > 1000) = 0;
fadTextImage(:,245:256)=0;
% display the NADH image in axes1
set(handles.text24,'String',fadFileName);
axes(handles.axes2);
imagesc(fadTextImage)
colormap(gray)
colorbar
%% Read NADH T1 Image
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
% Get the location of the image
[nadhT1FileName, nadhT1PathName] = uigetfile('*.asc','Pick an Image');
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , 'String', nadhT1FileName);
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 during object deletion, before destroying properties.
function edit1_DeleteFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%% Calculate Redox Ratio Button
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
redoxRatioImage = nadhTextImage./(nadhTextImage + fadTextImage);
axes(handles.axes6);
imagesc(redoxRatioImage)
colormap(gray)
colorbar
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 button press in pushbutton6.
function pushbutton6_Callback(~, ~, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhTextImage;
global fadTextImage;
global redoxRatioImage;
global maskImage;
global redoxRatio;
nadhIntensityImage = nadhTextImage.* maskImage;
fadIntensityImage = fadTextImage.* maskImage;
axes(handles.axes1);
imagesc(nadhIntensityImage)
colormap(gray)
colorbar
axes(handles.axes2);
imagesc(fadIntensityImage)
colormap(gray)
colorbar
redoxRatioIntensityImage = redoxRatioImage.* maskImage;
axes(handles.axes6);
imagesc(redoxRatioIntensityImage)
colormap(gray)
colorbar
redoxRatio = mean(redoxRatioIntensityImage(redoxRatioIntensityImage~=0),'omitnan');
set(handles.edit2 , 'String', num2str(redoxRatio));
%% Read NADH T2 Image and display
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT2Image;
% Get the location of the image
[nadhT2FileName, nadhT2PathName] = uigetfile('*.asc','Pick an Image');
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , 'String', nadhT2FileName);
%% Read NADH alpha Image and display
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhAlphaImage;
% Get the location of the image
[nadhAlphaFileName, nadhAlphaPathName] = uigetfile('*.asc','Pick an Image');
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , 'String', nadhAlphaFileName);
%% Calculate NADH FLIM mean
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(~, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Image;
global nadhT2Image;
global nadhAlphaImage;
global maskImage;
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
nadhFLIMMImage = (nadhT1Image.* nadhAlphaImage + nadhT2Image.*(100 - nadhAlphaImage))/100;
nadhFLIMMImageM = nadhFLIMMImage .* maskImage;
nadhAlphaImageM = nadhAlphaImage.* maskImage;
nadhT2ImageM = nadhT2Image .* maskImage;
nadhT1ImageM = nadhT1Image .* maskImage;
nadhAlphaMean = mean(nadhAlphaImageM(nadhAlphaImageM~=0),'omitnan');
nadhT2Mean = mean(nadhT2ImageM(nadhT2ImageM~=0),'omitnan');
nadhT1Mean = mean(nadhT1ImageM(nadhT1ImageM~=0),'omitnan');
nadhFLIMMMean = mean(nadhFLIMMImageM(nadhFLIMMImageM~=0),'omitnan');
set(handles.edit3 , 'String', num2str(nadhT1Mean));
set(handles.edit4 , 'String', num2str(nadhT2Mean));
set(handles.edit5 , 'String', num2str(nadhAlphaMean));
set(handles.edit6 , 'String', num2str(nadhFLIMMMean));
axes(handles.axes7);
imagesc(nadhT1ImageM)
colormap(gray)
colorbar
axes(handles.axes8);
imagesc(nadhT2ImageM)
colormap(gray)
colorbar
axes(handles.axes9);
imagesc(nadhAlphaImageM)
colormap(gray)
colorbar
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit4_Callback(hObject, ~, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit6_Callback(hObject, eventdata, handles)
% hObject handle to edit6 (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 edit6 as text
% str2double(get(hObject,'String')) returns contents of edit6 as a double
% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit6 (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
%% Read FAD T1 image and display
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
% Get the location of the image
[fadT1FileName, fadT1PathName] = uigetfile('*.asc','Pick an Image');
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , 'String', fadT1FileName);
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, ~, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT2Image;
% Get the location of the image
[fadT2FileName, fadT2PathName] = uigetfile('*.asc','Pick an Image');
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , 'String', fadT2FileName);
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(~, ~, handles)
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadAlphaImage;
% Get the location of the image
[fadAplhaFileName, fadAlphaPathName] = uigetfile('*.asc','Pick an Image');
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , 'String', fadAplhaFileName);
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(~, eventdata, handles)
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global fadT1Image;
global fadT2Image;
global fadAlphaImage;
global maskImage
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
fadFLIMMImage = (fadT1Image.* fadAlphaImage + fadT2Image.*(100 - fadAlphaImage))/100;
fadFLIMMImageM = fadFLIMMImage .* maskImage;
fadAlphaImageM = fadAlphaImage.* maskImage;
fadT2ImageM = fadT2Image .* maskImage;
fadT1ImageM = fadT1Image .* maskImage;
fadAlphaMean = mean(fadAlphaImageM(fadAlphaImageM~=0),'omitnan');
fadT2Mean = mean(fadT2ImageM(fadT2ImageM~=0),'omitnan');
fadT1Mean = mean(fadT1ImageM(fadT1ImageM~=0),'omitnan');
fadFLIMMMean = mean(fadFLIMMImageM(fadFLIMMImageM~=0),'omitnan');
set(handles.edit7 , 'String', num2str(fadT1Mean));
set(handles.edit8 , 'String', num2str(fadT2Mean));
set(handles.edit9 , 'String', num2str(fadAlphaMean));
set(handles.edit10 , 'String', num2str(fadFLIMMMean));
axes(handles.axes10);
imagesc(fadT1ImageM)
colormap(gray)
colorbar
axes(handles.axes11);
imagesc(fadT2ImageM)
colormap(gray)
colorbar
axes(handles.axes12);
imagesc(fadAlphaImageM)
colormap(gray)
colorbar
function edit7_Callback(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit7 as text
% str2double(get(hObject,'String')) returns contents of edit7 as a double
% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit7 (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 edit8_Callback(hObject, eventdata, handles)
% hObject handle to edit8 (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 edit8 as text
% str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit8 (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 edit9_Callback(hObject, eventdata, handles)
% hObject handle to edit9 (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 edit9 as text
% str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit9 (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 edit10_Callback(hObject, eventdata, handles)
% hObject handle to edit10 (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 edit10 as text
% str2double(get(hObject,'String')) returns contents of edit10 as a double
% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit10 (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 edit11_Callback(~, eventdata, handles)
% hObject handle to edit11 (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 edit11 as text
% str2double(get(hObject,'String')) returns contents of edit11 as a double
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit11 (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 edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (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 edit12 as text
% str2double(get(hObject,'String')) returns contents of edit12 as a double
% --- Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (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 edit13_Callback(hObject, eventdata, handles)
% hObject handle to edit13 (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 edit13 as text
% str2double(get(hObject,'String')) returns contents of edit13 as a double
% --- Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, ~, handles)
% hObject handle to edit13 (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
%% Select the file to save
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global saveExcelLocation;
[saveExcelName, saveExcelPath] = uigetfile('*.xlsx','Pick an excel file');
saveExcelLocation = strcat(saveExcelPath,saveExcelName);
set(handles.edit14 , 'String', saveExcelLocation);
function edit14_Callback(hObject, eventdata, handles)
% hObject handle to edit14 (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 edit14 as text
% str2double(get(hObject,'String')) returns contents of edit14 as a double
% --- Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit14 (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
%% Save the data to the excel file
% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhT1Mean;
global nadhT2Mean;
global nadhAlphaMean;
global nadhFLIMMMean;
global fadT1Mean;
global fadT2Mean;
global fadAlphaMean;
global fadFLIMMMean;
global redoxRatio;
global nadhThreshold;
global saveExcelLocation;
global nadhImageName ;
global fadImageName;
nadhFlimData = [nadhThreshold,redoxRatio,nadhT1Mean,nadhT2Mean,nadhAlphaMean,nadhFLIMMMean];
fadFlimData = [fadT1Mean,fadT2Mean,fadAlphaMean,fadFLIMMMean];
excelData = xlsread(saveExcelLocation,'Sheet1','E:E'); % read the column of interest
lastRowNumber = length(excelData)+ 2;
nadhWriteLoc = strcat('C',num2str(lastRowNumber));
nadhNameWriteLoc = strcat('A',num2str(lastRowNumber));
% save NADH data to the excel file
xlswrite(saveExcelLocation,nadhFlimData,'sheet1',nadhWriteLoc);
xlswrite(saveExcelLocation,nadhImageName,'sheet1',nadhNameWriteLoc);
% save FAD data to the excel file
lastRowNumber = lastRowNumber + 1;
fadWriteLoc = strcat('E',num2str(lastRowNumber));
fadNameWriteLoc = strcat('A',num2str(lastRowNumber));
xlswrite(saveExcelLocation,fadFlimData,'sheet1',fadWriteLoc);
xlswrite(saveExcelLocation,fadImageName,'sheet1',fadNameWriteLoc);
% --- Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global nadhThreshold;
global maskShowImage;
global nadhTextImage
nadhThreshold = get(handles.slider3 ,'Value');
% get the image mask
maskShowImage = nadhTextImage;
maskShowImage(maskShowImage < nadhThreshold) = 0;
set(handles.edit1 , 'String', num2str(nadhThreshold));
axes(handles.axes4);
imagesc(maskShowImage)
colormap(gray)
colorbar
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton17 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global nadhFileName;
global nadhPathName;
global nadhT1Image;
% Get the location of the image
nadhT1FileName = strrep(nadhFileName,'photons','t1');
nadhT1PathName = nadhPathName;
nadhT1Image = importdata(strcat(nadhT1PathName,nadhT1FileName));
nadhT1Image(nadhT1Image > 8000) = 0;
nadhT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes7);
imagesc(nadhT1Image)
colormap(gray)
colorbar
set(handles.text7 , 'String', nadhT1FileName);
global nadhT2Image;
% Get the location of the image
nadhT2FileName = strrep(nadhFileName,'photons','t2');
nadhT2PathName = nadhPathName;
nadhT2Image = importdata(strcat(nadhT2PathName,nadhT2FileName));
nadhT2Image(nadhT2Image > 8000) = 0;
nadhT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes8);
imagesc(nadhT2Image)
colormap(gray)
colorbar
set(handles.text8 , 'String', nadhT2FileName);
global nadhAlphaImage;
% Get the location of the image
nadhAlphaFileName = strrep(nadhFileName,'photons','a1[%]');
nadhAlphaPathName = nadhPathName;
nadhAlphaImage = importdata(strcat(nadhAlphaPathName,nadhAlphaFileName));
nadhAlphaImage(nadhAlphaImage>100) = 0;
nadhAlphaImage(nadhAlphaImage<0) = 0;
nadhAlphaImage(:,245:256) = 0;
% display the NADH image in axes7 and show the image name
axes(handles.axes9);
imagesc(nadhAlphaImage)
colormap(gray)
colorbar
set(handles.text9 , 'String', nadhAlphaFileName);
global fadFileName;
global fadPathName;
global fadT1Image;
% Get the location of the image
fadT1FileName = strrep(fadFileName,'photons','t1');
fadT1PathName = fadPathName;
fadT1Image = importdata(strcat(fadT1PathName,fadT1FileName));
fadT1Image(fadT1Image > 8000) = 0;
fadT1Image(fadT1Image < 0) = 0;
fadT1Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes10);
imagesc(fadT1Image)
colormap(gray)
colorbar
set(handles.text10 , 'String', fadT1FileName);
global fadT2Image;
% Get the location of the image
fadT2FileName = strrep(fadFileName,'photons','t2');
fadT2PathName = fadPathName;
fadT2Image = importdata(strcat(fadT2PathName,fadT2FileName));
fadT2Image(fadT2Image>8000) = 0;
fadT2Image(fadT2Image < 0) = 0;
fadT2Image(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes11);
imagesc(fadT2Image)
colormap(gray)
colorbar
set(handles.text11 , 'String', fadT2FileName)
global fadAlphaImage;
% Get the location of the image
fadAplhaFileName = strrep(fadFileName,'photons','a1[%]');
fadAlphaPathName = fadPathName;
fadAlphaImage = importdata(strcat(fadAlphaPathName,fadAplhaFileName));
fadAlphaImage(fadAlphaImage>100) = 0;
fadAlphaImage(fadAlphaImage<0) = 0;
fadAlphaImage(:,245:256)=0;
% display the NADH image in axes7 and show the image name
axes(handles.axes12);
imagesc(fadAlphaImage)
colormap(gray)
colorbar
set(handles.text12 , 'String', fadAplhaFileName);
  2 Comments
dpb
dpb on 23 Aug 2024
Unused variables are not errors, but mlint suggestions that could improve the code if the code is finished and there's not going to be a need for those variables in the future.
The code will still run...
What you posted is way too long and doesn't even highlight the specifics, but if the warnings bother you, either ask the original code developer from whom you got the code to fix it for you or can follow the mlint guidancee and fix it yourself. The standard suggestion is to just replace the variable in the argument list with the "~" character.
Jacob Mathew
Jacob Mathew on 6 Jun 2025
Adding for reference:
You can either ignore variables passed to the function using ~ as @dpb as mentioned, or refine the functions to use varagin so that you can parse the argument list as you see fit

Sign in to comment.

Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!