Month: August 2024
Formula Fill When Inserting Row
I have one table which lists a trailer number, the section of the yard in which it is parked, and then the row inside the parking spot (TrailerList). I also have a table which will show visually where the trailer is parked based on this list (TrailerPark). I have it set to auto-populate the trailer name from TrailerList into the correct location in TrailerPark using the formula =IFERROR(INDEX(TrailerList[[Trailer]:[Trailer]],MATCH(1,(TrailerList[[Section]:[Section]]=”A1″)*(TrailerList[[Row]:[Row]]=”1-1″),0)),””). The issue I have is I frequently need to adjust the size of a section (ex: making section “A1” 23 rows instead of 21 as shown). Currently when I add a row the new cells hold the formula from the top row, and pushes the old row 4 formula down to row 5. Is there a way to dynamically fil the formula to match its battleship grid location? Or at least keep the moved formula relevant to the row it gets moved to?
I have one table which lists a trailer number, the section of the yard in which it is parked, and then the row inside the parking spot (TrailerList). I also have a table which will show visually where the trailer is parked based on this list (TrailerPark). I have it set to auto-populate the trailer name from TrailerList into the correct location in TrailerPark using the formula =IFERROR(INDEX(TrailerList[[Trailer]:[Trailer]],MATCH(1,(TrailerList[[Section]:[Section]]=”A1″)*(TrailerList[[Row]:[Row]]=”1-1″),0)),””). The issue I have is I frequently need to adjust the size of a section (ex: making section “A1” 23 rows instead of 21 as shown). Currently when I add a row the new cells hold the formula from the top row, and pushes the old row 4 formula down to row 5. Is there a way to dynamically fil the formula to match its battleship grid location? Or at least keep the moved formula relevant to the row it gets moved to? Read More
Data Classification and Labelling in Azure SQL Database | Data Exposed
In this episode of Data Exposed with Anna Hoffman and Madhumita Tripathy, we talk about labelling a column in Azure SQL Database using Microsoft Information Protection (MIP) policy and propagation of MIP sensitivity labels from SQL Database to downstream applications such as Power BI reports and Office applications.
Resources:
Data Discovery & Classification
Data Discovery & Classification is now free for Azure SQL Database & Azure Synapse Analytics
Discovering, classifying, labeling & protecting SQL data – now available for all
View/share our latest episodes on Microsoft Learn and YouTube!
Microsoft Tech Community – Latest Blogs –Read More
Fastest Way of Opening and Reading .csv Files (Currently using xlsread)
I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts?I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts? I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts? excel, m, .mat, conversion, xlsread, csvread MATLAB Answers — New Questions
How can I create an impulse (delta) signal in Simulink?
How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not.How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not. How can I create an impulse (delta) signal in Simulink? I looked for it in "Sources" library but there is not. #simulink MATLAB Answers — New Questions
How reduce data from 3917×2 to 1868×2 without change the entire of graph?
I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis)I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis) I have zdata.mat contains data 3917×2 I need a way to reduce data to 1868×2 , (hint: first column refers to x axis, second column refers to y axis) reduce, size MATLAB Answers — New Questions
Microsoft Loop in Outlook (Permissions not working)
Up until recently when using a Microsoft Loop component inside Outlook you were able to add users to the email where Loop was embedded, and they would inherit permissions to that Loop component, and they were able to update within that Loop component.
What I’m seeing now and what’s being reported by end users is that when you go through the same steps and send the email to the recipients, they do not have access. They have to request access to the Loop component.
Has anyone experienced this recently? The only workaround it to create the Loop component outside of Outlook using the Loop app, or the web version where you can add the users
Up until recently when using a Microsoft Loop component inside Outlook you were able to add users to the email where Loop was embedded, and they would inherit permissions to that Loop component, and they were able to update within that Loop component. What I’m seeing now and what’s being reported by end users is that when you go through the same steps and send the email to the recipients, they do not have access. They have to request access to the Loop component. Has anyone experienced this recently? The only workaround it to create the Loop component outside of Outlook using the Loop app, or the web version where you can add the users Read More
Formül kopyalama
İçinde formül bulunan birden fazla hücre nasıl kopyalanır?
Ör:
A1, B1, C1, …, AA1
veya
A1
A2
A3
.
.
.
A99
Toplu halde formüller değişmeden başka sayfaya kopyalamak istiyorum. Nasıl yapabilirim.
(Herbir hücrede formül var.)
İçinde formül bulunan birden fazla hücre nasıl kopyalanır?Ör: A1, B1, C1, …, AA1veyaA1A2A3…A99Toplu halde formüller değişmeden başka sayfaya kopyalamak istiyorum. Nasıl yapabilirim.(Herbir hücrede formül var.) Read More
Equation Editor Wrong Highlight Color In Dark Mode
The highlight color in the Equation Editor is not correct when using dark mode in Word. The white text is unreadable. I’m seeing posts mentioning this issue from 4 years ago. How has this not been patched? How do I fix this myself if Microsoft won’t?
The highlight color in the Equation Editor is not correct when using dark mode in Word. The white text is unreadable. I’m seeing posts mentioning this issue from 4 years ago. How has this not been patched? How do I fix this myself if Microsoft won’t? Read More
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
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);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); 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); hobject, eventdata, handles MATLAB Answers — New Questions
Why am I getting different outputs between Matlab & SPSS?
I am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advanceI am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advance I am running a 3-way mixed ANOVA (2*6*2).
The between variable is Consciousness with 2 levels (conscious/ subconscious)
The within variables are: Congruency with 6 levels (RH, RF, UH, UF, NH, NF) & Target with 2 levels (BodyPart, Object).
I have run this in Matlab and had assumed I had generated the correct output, Code:
%Within Design Table
WithinDesign=table(categorical({‘Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’,’Related Hand’,’Related Foot’,’Unrelated Hand’,’Unrelated Foot’,’Neutral Hand’,’Neutral Foot’}’),categorical({‘BP’,’BP’,’BP’,’BP’,’BP’,’BP’,’O’,’O’,’O’,’O’,’O’,’O’}’),’VariableNames’,{‘Congruency’,’Target’});
%%
%3-Way Mixed Anova
OverallMixedANOVA=fitrm(OverallDataTable,’BP_RH_Con-O_NF_Sub~Consciousness’,WithinDesign=WithinDesign,WithinModel=’separatemeans’);
%Sphericity Calculation & Error Correction
OverallSphericity=mauchly(OverallMixedANOVA)
OverallErrorCorrect=epsilon(OverallMixedANOVA)
%Anova Table output
[OverallMixedANOVATable,A,C,D]=ranova(OverallMixedANOVA,"WithinModel",’Congruency*Target’)
%Corrections for significant sphericity
%CorrectedOverallMixedANOVATable=OverallMixedANOVATable;
%CorrectedOverallMixedANOVATable.DF=OverallMixedANOVATable.DF*OverallErrorCorrect.GreenhouseGeisser
Below is the Matlab Output:
The same data was used in SPSS to check my code. For all previous (2-way RM-) ANOVAs I have performed on Matlab the output has been the same, but in this case the output was different.
Here is the SPSS code pasted to the log:
GLM BP_RH O_RH BP_RF O_RF BP_UH O_UH BP_UF O_UF BP_NH O_NH BP_NF O_NF BY Consciousness
/WSFACTOR=Congruency 6 Polynomial Target 2 Polynomial
/MEASURE=Tradeoff
/METHOD=SSTYPE(3)
/PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/WSDESIGN=Congruency Target Congruency*Target
/DESIGN=Consciousness.
Output from SPSS pasted below:
Different values are highlighted in blue.
I’d like to know why I am getting different values. I know that the p values are still signficant for both methods of analysis, but when looking for replicability this doesnt seem to be satisfactory.
My Questions are:
Have I input the factors correctly in the Matlab code?
Why are the values different between the two softwares?
Does it matter that Matlab and SPSS generate different statistics?
Do you have any reccomendations for what I can do to improve my code?
Thanks in advance statistics, software differences MATLAB Answers — New Questions
Undocked Editor, ctrl+shift+0 doesn’t bring editor to front as active window
Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently)Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently) Hello,
I run a X11 forwarded instance of matlab 2017b (ran from a linux server) with a tabbed, undocked, editor on a windows machine. I love motion binds (vim user btw), and I often jump between the command window and editor with ctrl+0, ctrl+shift+0 respectfully.
I noticed that the undocked editor is not brought to the front as my active window despite my cursor being in that window and can still type. I then windows alt-tab to the editor to bring the window to the front and loose my cursor…. making me regrettably pick up my mouse.
Ex. I have a chat client open over my editor on my right monitor and I am working in the command window on my left monitor. I then open a script or ctrl+shift+0 over to the editor and the editor window is not brought to the front of the chat client.
Any Ideas on how I can tweak these settings to bring to front via matlab keybind? (Looking into X11 settings currently) editor, x11, ctrl+shift+0, keybind, window management MATLAB Answers — New Questions
Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer?
Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer?Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer? Is it possible to have multiple releases of MATLAB and/or Polyspace on the same computer? MATLAB Answers — New Questions
Guest users limitations
Hi!
Can guest users use the Updates and Approvals apps?
Hi!Can guest users use the Updates and Approvals apps? Read More
Management Profile Not Verified
I manage 600 iPads in Intune and today I realized that about 100 of them are showing the management profile as not verified. I believe the problem is they sat unconnected for over 90 days. They are still listed in my apple business account and in the enrollment token devices in Intune. They are not listed inside the groups that were created for them. When I look at my enrollment token the iPads with not verified management profiles display and they are in the correct profiles. When I view the devices under the profile they show an enrolled state and that they last contacted today.
On the device under the management profile that show not verified I have 1 cert, Microsoft Intune application enrollment CA, that is expired. And 2 signing certificates that are expired, IOSProfileSigning.manage.microsoft.com and Microsoft Azure TLS issuing CA 01. Is there any way to renew these certs without having to rebuild the ipads?
I manage 600 iPads in Intune and today I realized that about 100 of them are showing the management profile as not verified. I believe the problem is they sat unconnected for over 90 days. They are still listed in my apple business account and in the enrollment token devices in Intune. They are not listed inside the groups that were created for them. When I look at my enrollment token the iPads with not verified management profiles display and they are in the correct profiles. When I view the devices under the profile they show an enrolled state and that they last contacted today. On the device under the management profile that show not verified I have 1 cert, Microsoft Intune application enrollment CA, that is expired. And 2 signing certificates that are expired, IOSProfileSigning.manage.microsoft.com and Microsoft Azure TLS issuing CA 01. Is there any way to renew these certs without having to rebuild the ipads? Read More
Essential Steps to Kickstart Your Azure Journey
Starting a new cloud environment is a pivotal moment, and building a robust infrastructure from the outset is essential. Microsoft Azure offers a scalable and powerful platform, but establishing your environment correctly is crucial for long-term success. This guide outlines the key steps to set up a secure, cost-effective, and scalable Azure environment. Each step is accompanied by actionable insights, real-world examples, and reasons why it’s important.
1. Create Custom Virtual Networks (VNet)
Azure provides a default VNet, but creating a custom VNet allows you to tailor your network setup to your specific needs. This customization enhances both security and performance by allowing you to segment your network into subnets that separate different environments like development, staging, and production. This segregation helps you apply security policies more effectively and manage traffic flows efficiently.
Example: Imagine you’re developing a SaaS application for various clients. Creating a custom VNet with isolated subnets for each client ensures their data is separated, enhancing security and performance. This setup prevents unauthorized access between different clients’ data and optimizes network traffic.
Learn more about creating and configuring a VNet
2. Set Up Cost Management and Budgets
Effective cost management is crucial for startups, as it helps you stay within budget and make informed financial decisions. Azure Cost Management provides tools to monitor and analyze your spending, while budget alerts notify you when you’re nearing or exceeding your budget. This proactive approach helps prevent unexpected expenses and ensures you allocate resources efficiently.
Example: Suppose you’re rolling out a new feature and need to monitor its associated costs closely. Setting a budget alert for your development environment ensures you’re notified if you approach your budget limit, allowing you to adjust spending or optimize resource use to stay within financial constraints.
Start with Azure Cost Management
3. Enable Azure Activity Logs, Log Analytics, and Resource Health Alerts
Azure Activity Logs provide visibility into actions taken within your subscription, while Azure Log Analytics allows you to analyze these logs for insights. Resource Health Alerts help you monitor the health of your resources, ensuring that you’re promptly informed of any issues affecting performance or availability. This combination allows for proactive issue resolution and enhances operational efficiency.
Integrate Activity Logs with Log Analytics to track and analyze operations. Set up Resource Health Alerts to get notifications about service disruptions or performance issues. This setup helps you address problems quickly, minimizing their impact on your users and ensuring smoother operations.
Example: If your team frequently deploys updates, monitoring Activity Logs helps identify changes that might introduce issues. Resource Health Alerts notify you if a critical resource, like your database, encounters problems, allowing you to take corrective action before it affects your users.
Learn about Resource Health Alerts
4. Configure Password Policy and Conditional Access
A strong password policy and Conditional Access in Azure Active Directory (AD) are fundamental for securing your startup’s resources. Enforcing a robust password policy reduces the risk of unauthorized access due to weak passwords. Conditional Access helps control access based on user behavior and risk factors, adding an extra layer of security.
Example: For a fintech startup handling sensitive financial data, implementing Conditional Access to require Multi-Factor Authentication (MFA) for high-risk actions protects against unauthorized access. This ensures that even if passwords are compromised, additional verification steps are required to access sensitive information.
Explore Azure AD Conditional Access
5. Enforce Multi-Factor Authentication (MFA)
Multi-Factor Authentication (MFA) adds an additional verification step beyond just a password, enhancing security by requiring something you know (password) and something you have (a code sent to your phone, for instance). This added layer helps protect against unauthorized access, even if passwords are compromised.
Example: In a healthcare startup dealing with patient data, enforcing MFA ensures that only verified users can access sensitive medical records. Even if a password is stolen, the second authentication factor provides an additional barrier to unauthorized access.
Learn more about enabling MFA in Azure AD
6. Enable Microsoft Defender for Cloud
Microsoft Defender for Cloud provides ongoing security assessments and recommendations to help you maintain a strong security posture. It helps identify vulnerabilities, misconfigurations, and potential threats, allowing you to address them before they become serious issues.
Example: For a startup developing an AI-driven product that handles sensitive data, Defender for Cloud can alert you to security gaps or misconfigurations. By addressing these issues proactively, you protect your intellectual property and maintain user trust.
Get started with Microsoft Defender for Cloud
7. Set Up Azure Role-Based Access Control (RBAC)
Azure Role-Based Access Control (RBAC) allows you to assign specific roles with defined permissions to users. This principle of least privilege ensures that users have only the access necessary for their tasks, minimizing the risk of accidental or malicious changes to your resources.
Example: For a small development team, configuring RBAC to limit access to production environments ensures that only authorized team members can deploy updates. This reduces the risk of unintended disruptions or unauthorized changes.
8. Implement Azure Policy and Azure Blueprints
Azure Policy helps enforce organizational standards and compliance by applying rules to your Azure resources. Azure Blueprints allow you to deploy environments consistently according to predefined policies. These tools help maintain governance and compliance as your startup scales.
Example: As your startup expands into new markets with varying regulatory requirements, using Azure Blueprints ensures that new environments comply with local regulations efficiently. This approach saves time and ensures consistent compliance across your organization.
9. Develop and Apply a Tagging Strategy
Tags are essential for organizing and managing your Azure resources. By applying a consistent tagging strategy, you can track costs, enforce policies, and simplify resource management. Tags help you categorize resources by environment, owner, project, or other criteria.
Example: If you’re managing multiple projects, using tags like Environment, Owner, and Project helps you monitor and allocate costs accurately. This organization facilitates budget reporting and resource management, making it easier to track expenses and optimize usage.
Best practices for tagging in Azure
10. Enable Azure Management Groups
Azure Management Groups provide a way to organize multiple Azure subscriptions into a unified hierarchy. This organization simplifies the application of policies and management of compliance across different subscriptions, making governance more manageable as your startup grows.
Example: As your startup expands globally and opens new offices or departments, Management Groups allow you to enforce consistent policies and compliance across all your subscriptions. This unified approach streamlines governance and ensures that your organization adheres to regulatory requirements.
Understanding Azure Management Groups
Pro Tip: Automate Your Setup with Infrastructure as Code (IaC)
Automating your environment setup with Infrastructure as Code (IaC) tools reduces manual effort and minimizes the risk of errors. IaC ensures that your deployments are consistent, repeatable, and scalable, saving you time and effort as you grow.
Example: If you need to deploy identical environments for development, staging, and production, using IaC tools like Azure Resource Manager (ARM) templates or Terraform allows you to automate these deployments. This approach ensures that each environment is configured consistently and efficiently.
Introduction to Azure Resource Manager templates
Getting started with Terraform on Azure
Conclusion
Implementing these steps will provide a strong foundation for your Azure environment, helping you manage costs, maintain security, and scale efficiently. By following these actionable recommendations, you set your startup up for success and make the most of Azure’s capabilities. For a more detailed and structured approach to setting up your Azure environment, consider exploring the Azure Setup Guide, which offers a comprehensive framework to ensure a robust and scalable Azure setup.
Microsoft Tech Community – Latest Blogs –Read More
Maximum variable size allowed by the program is exceeded.
i have this problem
how can i resolve it plz !i have this problem
how can i resolve it plz ! i have this problem
how can i resolve it plz ! #variable, #size, matlab MATLAB Answers — New Questions
How does dlgradient handle two output layers?
I have a deep learning image analysis network with a custom training loop and loss function. In this loss function I take the output layer’s output and the second to last layer’s output from the net, perform mse (using the inbuilt function) on both, and sum the results. My output layer is a custom layer, so I have control over it’s backwards function, but I cannot see the automatic backwards in the other layers.
When I use dlgradient on this new loss, how does Matlab handle two simultaneous rounds of differentiation? Does it sum the gradients for each learnable, or does one gradient calculation override the other?
I have tried both adam and SGDM methods of updating gradients, but I am suspecting since my network is not learning as expected that I need to adjust my backwards function in my custom layer to ensure a proper gradient backpropagation.I have a deep learning image analysis network with a custom training loop and loss function. In this loss function I take the output layer’s output and the second to last layer’s output from the net, perform mse (using the inbuilt function) on both, and sum the results. My output layer is a custom layer, so I have control over it’s backwards function, but I cannot see the automatic backwards in the other layers.
When I use dlgradient on this new loss, how does Matlab handle two simultaneous rounds of differentiation? Does it sum the gradients for each learnable, or does one gradient calculation override the other?
I have tried both adam and SGDM methods of updating gradients, but I am suspecting since my network is not learning as expected that I need to adjust my backwards function in my custom layer to ensure a proper gradient backpropagation. I have a deep learning image analysis network with a custom training loop and loss function. In this loss function I take the output layer’s output and the second to last layer’s output from the net, perform mse (using the inbuilt function) on both, and sum the results. My output layer is a custom layer, so I have control over it’s backwards function, but I cannot see the automatic backwards in the other layers.
When I use dlgradient on this new loss, how does Matlab handle two simultaneous rounds of differentiation? Does it sum the gradients for each learnable, or does one gradient calculation override the other?
I have tried both adam and SGDM methods of updating gradients, but I am suspecting since my network is not learning as expected that I need to adjust my backwards function in my custom layer to ensure a proper gradient backpropagation. deep learning, neural network MATLAB Answers — New Questions
Replace NaN’s in table with zero
Hello, I have a 1501×7 table called ‘x’ and there appears to be NaN’s in the fourth and sixth column called "Age" and "height". I would like a way to replace NaN’s with zeros. Take note, that I have already tried:
k = find(isnan(x))’;
x(k) = 0;
% and
x(isnan(x)) = 0;
Yet, neither work because I am using a table, not a matrix. I have also tried converting my table into a cell array, and using these same functions, but they still do not work. They return:"Undefined function ‘isnan’ for input arguments of type ‘cell’"
ALSO, please note that the table has columns full of text. So, cell2mat does not work.Hello, I have a 1501×7 table called ‘x’ and there appears to be NaN’s in the fourth and sixth column called "Age" and "height". I would like a way to replace NaN’s with zeros. Take note, that I have already tried:
k = find(isnan(x))’;
x(k) = 0;
% and
x(isnan(x)) = 0;
Yet, neither work because I am using a table, not a matrix. I have also tried converting my table into a cell array, and using these same functions, but they still do not work. They return:"Undefined function ‘isnan’ for input arguments of type ‘cell’"
ALSO, please note that the table has columns full of text. So, cell2mat does not work. Hello, I have a 1501×7 table called ‘x’ and there appears to be NaN’s in the fourth and sixth column called "Age" and "height". I would like a way to replace NaN’s with zeros. Take note, that I have already tried:
k = find(isnan(x))’;
x(k) = 0;
% and
x(isnan(x)) = 0;
Yet, neither work because I am using a table, not a matrix. I have also tried converting my table into a cell array, and using these same functions, but they still do not work. They return:"Undefined function ‘isnan’ for input arguments of type ‘cell’"
ALSO, please note that the table has columns full of text. So, cell2mat does not work. nan, zeros, replace, matrix, cell, basic, beginner, replacement, remove, tables, format MATLAB Answers — New Questions
uigetfile MultiSelect does not work on Mac?
I use uigetfile with MultiSelect on in my code. It works fine on a PC but doesn’t allow selecting multiple files on a Mac. Is multiselect supported on Mac?
Here’s my code:
[file_list,PathName] = uigetfile(‘*.tif’,’Select the source images’,’MultiSelect’,’on’);I use uigetfile with MultiSelect on in my code. It works fine on a PC but doesn’t allow selecting multiple files on a Mac. Is multiselect supported on Mac?
Here’s my code:
[file_list,PathName] = uigetfile(‘*.tif’,’Select the source images’,’MultiSelect’,’on’); I use uigetfile with MultiSelect on in my code. It works fine on a PC but doesn’t allow selecting multiple files on a Mac. Is multiselect supported on Mac?
Here’s my code:
[file_list,PathName] = uigetfile(‘*.tif’,’Select the source images’,’MultiSelect’,’on’); uigetfile, multiselect, mac MATLAB Answers — New Questions
Adjusting table columns by a grouped value
When working with my dataset, I find that I need to adjust the data in ways that makes the plots more understandable. In this particular example, I’m trying to adjust the times in a table by finding the minimum value for every run, then subtracting the minimum value to every run so that each run in my dataset all start at t=0 on a plot.
I can find the mimium value, and have created a table with those values, however I am not sure how to apply these values to the main table, so that I can create an additional column with the adjusted time. I believe it has something to do with rowfun, but I can’t figure out how to get around the different sizes of the rows to get a proper calculation. I will be adding what I have so far in an attachment. Thank you.When working with my dataset, I find that I need to adjust the data in ways that makes the plots more understandable. In this particular example, I’m trying to adjust the times in a table by finding the minimum value for every run, then subtracting the minimum value to every run so that each run in my dataset all start at t=0 on a plot.
I can find the mimium value, and have created a table with those values, however I am not sure how to apply these values to the main table, so that I can create an additional column with the adjusted time. I believe it has something to do with rowfun, but I can’t figure out how to get around the different sizes of the rows to get a proper calculation. I will be adding what I have so far in an attachment. Thank you. When working with my dataset, I find that I need to adjust the data in ways that makes the plots more understandable. In this particular example, I’m trying to adjust the times in a table by finding the minimum value for every run, then subtracting the minimum value to every run so that each run in my dataset all start at t=0 on a plot.
I can find the mimium value, and have created a table with those values, however I am not sure how to apply these values to the main table, so that I can create an additional column with the adjusted time. I believe it has something to do with rowfun, but I can’t figure out how to get around the different sizes of the rows to get a proper calculation. I will be adding what I have so far in an attachment. Thank you. table, rowfun, groups, plot MATLAB Answers — New Questions