mairplot throws uimenu error

Dear all,
I have been following the rnaseq demo (https://www.mathworks.com/help/bioinfo/ug/identifying-differentially-expressed-genes-from-rna-seq-data.html) to build out a livescript to analyze some differential gene expression data. However, I'm having issues with generating an interactive MA plot using mairplot.
I used a larger version of the attached input data file (data_head.txt) to populate a table (data). I then issued mairplot as follows:
mairplot(data.meanTreated,data.meanUntreated,'Labels',data.sgRNA_ID,'Type','MA');
However, I get the following error:
Error using uimenu
First argument must be a valid parent, such as a Figure or Panel object.
Error in mairplot>resetFigureTools (line 345)
uimenu(hw,'Label','Export to Workspace...','Position',1, 'Callback', @exportDiffResults);
Error in mairplot (line 168)
resetFigureTools(hFig);
I did convert the data.sgRNA_ID table variable from a cell array to strings using
data.sgRNA_ID = string(data.sgRNA_ID)
, but got the same error.
I was able to run the example code (rnaseqdemo.m; attached), including the interactive MA plot.
I was also able to successfully create an MA plot with the following command:
mairplot(data.meanTreated,data.meanUntreated,'Type','MA','Plotonly',true);
Thank you for your help! Let me know if you need more info to help me troubleshoot this.
Best,
Kartik

Answers (1)

dpb
dpb on 9 Nov 2025
Edited: dpb on 10 Nov 2025
%type mairplot.m
I looked into mairplot and it starts the working part of the function with the following lines--
hFig = figure('Units',units, 'Tag', 'mairplot',... 'Visible', 'off', 'MenuBar', 'figure');
%== Init appdata
appdata = localGetAppData(hFig);
appdata.hfig = hFig;
It creates an ordinary figure handle and then later on tries to modify its menu to add the additional functionality desired.
When you put the code inside a a uifugure instead, then the two figure types are incompatible; as it stands the function will not work in a uifigure environment. That's why it works for you interactively or with the demo code; they're both regular figures.
I don't have the TB to play with interactively and one can't create uifigures here, so not much else can do myself to see about any sort of workaround...you might try creating a panel in your app figure -- but, no, as written you can't pass a parent handle to mairplot so there's not a way to put it there, either.
You may have to make a local copy of the function in your own working directory (renaming it to something like mymairplot.m) and then mung on it to be able to pass in the parent figure of your uifigure instead of it creating one.
ADDENDUM:
This would appear to be worthy of an enhancement submission to extend the functionality to the uifigure environment.

4 Comments

Thank you! However, I’m a bit confused. Where am I creating the uifigure? The only difference between the two mairplot function calls is that in one case, I’m using a ‘labels’ parameter and in the other case, I’m using ‘PlotOnly’

The latter works but the former gives the error. I’m not explicitly creating a uifigure anywhere. The command syntax is exactly the same as in the demo example, and the ‘labels’ version works in the demo.

Thanks!

You said you were in an app -- MATLAB creates app's in uifigures unless you are building it programmatically in old GUIDE style.
We don't have the whole context of the code; only the one line snippet so if the base assumptions are wrong, we need to see enough to be able to recreate the issue with a minimum working example.

Yes, sorry. It was a livescript. I will share it in this thread shortly .

Thanks for your help. Kartik

dpb
dpb on 12 Nov 2025
Edited: dpb on 13 Nov 2025
".... It was a livescript."
Oh, yeah...I have never even looked at live scripts, don't fit my present use patterns.
Not sure what kind of wrapper code there is for them...and, unfortunately, I don't have the TB locally, but we can try to poke at your environment some and see what can discover about what is a parent object maybe.

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Release

R2023b

Asked:

on 9 Nov 2025

Edited:

dpb
on 13 Nov 2025

Community Treasure Hunt

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

Start Hunting!