File Exchange

image thumbnail

Flow Cytometry GUI for Matlab

version (8.35 MB) by Nitai Steinberg
This GUI was built in order to make Flow Cytometry data analyses in Matlab – gating, statistics etc.


Updated 18 Jan 2016

View Version History

View License

Elaborate documentation can be found in the 'FCGUI_help.pdf' file.
Some of its functionalities:
* Present scatter plot (+density color map) or histograms (+values of statistical measures), of FC data and of gates, X and Y axis selection among the different parameters that were collected, linear or logarithmic display, and option to export the plot to a separate Matlab figure
* Move between FC files keeping the same display setting
* Gating in different methods: manually – draw a shape on the plot, automatically – select # cells from a center (circle, or according to the density of cells in plot), quadrants, thresholds on histogram plot, and logical operations on the created gates
* Saving the data of cells included in a gate, or the gate coordinates, into .mat files, and load it on a different FC data file
* Make calculations on the collected parameters for each cell (e.g. normalize fluorescence to SSC)
* Make a multiplot figure of scatter plots or histograms, of a few FC data files.
This GUI was built with the aid of the 'GUI layout toolbox' (file exchange submission, see link below), and it is required for its functionality, download it and run the 'install.m' file there.
This submission includes the following file exchange submissions: 'Fast points-in-polygon test' by Darren Engwirda, ' Distance from a point to polygon' by Alejandro Weinstein, 'Subaxis - Subplot' by Aslak Grinsted, see links below.
Please, help to improve it:
1. Report any bug or inconvenience you experience.
2. Make suggestions on how to improve it.
3. Modify the code and share what you changed.
Some open issues:
1. Logicle (biexponential) display is missing. An implementation of the logicle transformation in Matlab is needed (see Parks et al. 2006, and Moore and Parks 2012 papers).
2. 'Fast points-in-polygon test' by Darren Engwirda, was found to be faster here in the .mex file version (see '2D polygon interior detection' by Bruno Luong). It was not included here to simplify installation and compatibility issues (see remark in help file section 1 for how to use it here).

Nitai Steinberg
At Prof. Yitzhak Pilpel Lab,
Molecular Genetics Department
The Weizmann Institute of Science

Cite As

Nitai Steinberg (2021). Flow Cytometry GUI for Matlab (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (26)

Jiahe Zhang

Unable to resolve the name uiextras.HBoxFlex.

Agustin Cruz

I can't get the FCSExtract.exe from the stower's institute. I use the link and it redirects me, but I can't find the file to download and run. Can anyone help me ?
Thank you

Carlos E Gomez C

Hello Nitai,

I get this errors while trying to run FCGUI_main in matlab (I tried matlab 2019 and 2016 since I thought there might be compatibility issues):

Undefined variable "uix" or class "uix.HBoxFlex".

Error in FCGUI_build (line 181)
handles.bigGrid = uix.HBoxFlex('Parent',handles.figure,'Padding',5,'Spacing',3);

Error in FCGUI_main (line 59)
handles = FCGUI_build;

Do you have suggestion? I tried to download Verduijn files, but the link already expired.
Thank you,


J.M. Verduijn

J.M. Verduijn

Dear all,
As a novice matlab user I had similar problems as described below, most likely caused because of the update of the GUI layout toolbox ( The things that have to be changed are 1) uiextras. to uix. 2) to alter the 'Sizes' parameter of VBox and HBox be changed to Heights and Widths and 3) SelectionChild to Selection. I made these changes myself and zipped the files, WeTransfer:

Suggestions are welcome.

With kind regards,
J.M. Verduijn

yang deng

Hi Nitai,
Thanks very much for your great job, I'm encountering a problem in using cvs2mat.m, 'Unabele to open file: 5637.csv', I'm pretty sure I have selected the right folder (of the csv), but i cannot convert the csv into mat. I'm using matlab r2017b on a windows x64 pc.

yang deng

Sorry there is a mistake in last comments,it should be 'I cannot convert the cvs into mat.'

Kai Schulz

Dear Nitai,

great job, this is a marvelous tool and it works like a charm! One thing though I didn't manage to figure out, is there a way to save logic gates as when I move to the next FCM file, it appears that I have to re-define them all over again? Also, is there a way to keep the selected gates for the new file or do I have to load them again?

Many thanks

Russell Arnott

I'm just dipping my toe into the world of FC so thought I'd try this toolbox for Matlab.
I have installed the GUI Layout Toolbox compatible for my Matlab version (R2015b) and have installed the FCGUI but when i run FCGUI_main, I get this:
Warning: HGUsingMATLABClasses will be removed in a future release. For more information about
writing code that works in multiple releases, click here.
> In isHGUsingMATLABClasses
In uiextras.Container (line 65)
In uiextras.Box (line 38)
In uiextras.HBox (line 44)
In uiextras.HBoxFlex (line 45)
In FCGUI_build (line 181)
In FCGUI_main (line 59)
Error using uiextras.Container (line 66)
Trying to run using double-handle MATLAB graphics against the new graphics system. Please

Error in uiextras.Box (line 38)
obj@uiextras.Container( varargin{:} );

Error in uiextras.HBox (line 44)
obj@uiextras.Box( varargin{:} );

Error in uiextras.HBoxFlex (line 45)
obj@uiextras.HBox( varargin{:} );

Error in FCGUI_build (line 181)
handles.bigGrid = uiextras.HBoxFlex('Parent',handles.figure,'Padding',5,'Spacing',3);

Error in FCGUI_main (line 59)
handles = FCGUI_build;

Any thoughts?

Nitai Steinberg

Hi Magan,
Maybe they changed the location?
In any case, when I Googled it this is the current website that I found:
I'm pretty sure it's the same software.
Tell me if you need anything else,
Good luck!

Megan Cole

Hello Nitai,

Thank you for a great application to analyse FACS data.
On the FCGUI help file, there is a link provided to allow the conversion of the .fcs file to a CSV file, which I would need to a
enable analysis of my fcs data. However, this link no longer works as the webpage is no longer available.
Please could you provide another link that would allow this conversion?
Many thanks

Nitai Steinberg

Hi Geran,
Sorry for the very late response, it was a long time since I uploaded this GUI and I wasn't updating so frequently since then.
Thank you for your comment, and the fix, I hope people could use it if they encounter the problem, I think I didn't use so much the loading gate option so this is why I didn't encounter the problem, I am happy you could fix it.

Geran Kostecki

Great submission, just what I needed. Had an error when trying to load gates as dependents/children on line 1624. I fixed it by adding a line as follows:

isempty(strfind(gateType,'semiauto'))&& ...
~ischar(hObject) && ...

there and also on line 1775:

if isempty(strfind(gateType,'semiauto')) &&...
~ischar(hObject) && ...

I don't think it messed anything else up... but please tell me if I'm wrong.

Nitai Steinberg

Hi Andrea,

I think maybe I know what cause your problem, but not sure so tell me:
The window that you open does not suppose to show you the csv files - you suppose to select the folder in which the csv files are located, once you select the folder (and the output folder) the files will be converted automatically.
I am sorry for the confusion, I think I wrote it like that and not like select directory because the interface was easier (I changed it to not show any file type).
Please tell me if it worked!

Andrea Barzaghi

Thank you for your great work!
I'm encountering a problem in using cvs2mat.m: the GUI (of cvs2mat) doesn't display any csv files (although they're there), so I cannot convert them into csv.

I'm using matlab r2016a on a linux x64 pc.

Nitai Steinberg

I am happy to hear that.
Please tell me if you encounter any other problem.
Good luck!

Estelle Dacheux

Dear Nitai,

Sorry for not getting back to you earlier (I switched to something else for a while).
I just had a try and it works perfectly now. Thank you very much for your help.

Best wishes.


Nitai Steinberg

Dear Estelle,

OK, I think that I understand now what I meant, and I corrected the error in the new version I now uploaded.

Please tell me if it now works for you (also without using logical gates, but just unselect 'all data' as you did before).

Thanks again for letting me know,

Nitai Steinberg

Dear Estelle,

I am afraid it is the same problem, and because a lot of time passed since I wrote this code, it will take me a while to fix it...
The reason is, that I think that MATLAB changed in the newer versions some things that now the code I wrote needed to be changed a little bit in order to be again compatible with those changes. But I need to remember why I wrote those lines and then rephrase them.
I think that for now - as a workaround, temporary solution to the problem - you can create two separate gates - one with the radial option, and the other with the trimmed population, and then intersect them using the logical gate (marked with the red intersection symbol). I tried it and it works.
In the meanwhile I will try to understand my code, and fix those problematic lines.
Thank you for raising these issues, and please tell me if it worked for you.

Estelle Dacheux

Dear Nitai,

Thank you very much for the update. I played a lot with the app yesterday and I still have some trouble. Making a gate on the whole population works, but when I try to create a gate automatically (using the "radial" option, a center and a certain number of cells) on a subpopulation (for example trimmed off 5% top and bottom SSC-A and FSC-A values but kept as population, or just a rectangular gate I drew), then it gives me the same kind of error as before:

Error using num2str (line 45)
Input to num2str must be numeric.

Error in FCGUI_main/saveGate_callback (line 1622)
(~strcmp(num2str(hObject),'logical') && ...

Error while evaluating UIControl Callback

Is it because it never was possible to create another subpopulation within a previously selected population or is it because there still are some problematic lines within the code?

Many thanks in advance for your help.


Nitai Steinberg

Dear Estelle,

Thank you for your comment!
I don't know why I wrote it the way I did (it is a long time since I touched this code) - but maybe it is a matter of Matlab versions... not sure. But I also had this error when trying to use it in 2015a, and I built it in 2010b, so maybe something changed with one of Matlab functions...

I am uploading a fix of this line (just removed the num2str in this line) - I hope it will not make problems for people who use earlier versions of Matlab...

Tell me if you encounter more problems.


Estelle Dacheux

Dear Nitai,

I systematically get this error message whenever I am trying to save a gate:

Error using num2str (line 45)
Input to num2str must be numeric.

Error in FCGUI_main/saveGate_callback (line 1771)
if ~ismember(1,chosenGates) || strcmp(num2str(hObject),'logical')

Error while evaluating UIControl Callback

Without gating, no analysis possible... Hava you any idea of what is wrong?
Many thanks in advance for your help.

Best regards,


Nitai Steinberg

Dear Joakim Sandstedt,
Thank you for your comment, I am happy you use this software and like it.
About the error message you encounter, it looks like it relates to the "GUI Layout Toolbox" I used to build this GUI (
I don't know what cause this specific error, but if I have to guess, it might be related to the Matlab version that you use.
Do you encounter problems in changing the window size? or is it just this error that appears in the beginning and that's it?
If you want you can address the people that wrote the toolbox and describe what you experience. I am sorry but I am not familiar with their code, I just used it, so I can't help you more than this...
In any case I hope you can still work with this software, and please tell me about any other problem you encounter, and I hope I could be more helpful :)
Good luck,

Joakim Sandstedt

Dear Nitai Steinberg!

Thank you for an excellent application for analysis of FACS data which I also plan to use for quantification of immunocytochemistry data obtained from CellProfiler. I'm quite new to the Matlab script language, but I noticed when I started the program the following error message:
Error using set
Values must be finite and non-NaN

Error in uiextras.Container/repositionChild (line 376)
set( child, propname, position );

Error in uiextras.VBox/redraw (line 88)
obj.repositionChild( child, newPosition );

Error in uiextras.Container/onResized (line 326)

Error in uiextras.Container>@(varargin)obj.onResized(varargin{:}) (line 90)
obj.Listeners{end+1,1} = handle.listener( containerObj, findprop(
containerObj, 'PixelBounds' ), 'PropertyPostSet', @obj.onResized );

The application seems to be working correctly, so this might not be anything of importance. Thanks again for a very nice application.

Kind regards

Joakim Sandstedt M.D., PhD student

Department of Clinical Chemistry and Transfusion Medicine,
Institute of Biomedicine, The Sahlgrenska Academy

Nitai Steinberg

Hi Nicole,
Thank you very much for the feedback, it is very important to me.
About the issues you raised:
- I also have Windows machine, and I didn't experienced these problems. I used "\" and not "/" as far as I noticed... (at least in 'private\rorchach.mat' I used "\" and I tried to look for "/" in the file and saw it only in divisions). But please tell me if I am mistaken.
- As for the implementation of the logicle display, I need help, I am not sure I know how to do it efficiently.
- I didn't experience the issue with the little log scale tick marks in 2D plots... If you could tell me exactly which settings you used, or even send me a screenshot it would be helpful.
- About multiple plot of the same file using different X and Y axes for each plot, there is no such option for now. I need to think about it, another person raised a similar issue regarding the multiple plots. I created it for my own use, but I understand that there are many things I didn't think about. Maybe I could try to change it in future version...
Thanks again for your feedback!


This is an excellent flow cytometry toolkit/gui for matlab. What I like most about this plug-in is the fact that I don't have to be a matlab master to use it. I hope you continue to develop it since it has a lot of potential.

- There are some path issues in using this plugin on a Windows installation of matlab involving \ vs /. Once repaired, the software works as advertised. (I fixed it awhile ago on my copy, so I fear I've forgotten which files are affected. But at the very least, do a search for "private/rorschach.mat" in FCGUImain.m and change to "private\rorschach.mat" if you have a Windows machine. I seem to remember at least one other file needs a similarly trivial change.)

Feature Requests:
- As you said in "open issues," implementing a logicile/biexponential display would be very beneficial.
- When I try to make a multiple plot figure of 2D histograms, and set them to have the same x/y scale (i.e. 1:1), the little log scale tick marks don't follow suit. I end up deleting them by hand.
- While I can clearly see how to make a multiple plot of several different files, using the same dyes for their x and y axes, I don't see how to make a multiplot of the same file using different dyes for the x and y axes.

Thank you for your hard work on this plug in.

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!