
gplotmatrix does not show graphics correctly on app designer app
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
antti heikkinen
le 24 Mai 2021
Commenté : Adam Danz
le 25 Mai 2021
Hi,
I have tried to use gplotmatrix in 2 formats shown below in my app. Both result to bunch of error messages in matlab side and graph which does not have histograms on diagonal. Tried also to put variable names on diagonal, but that feature does not work either.
gplotmatrix(app.Panel_2,app.Predictors,[],[],[],[],[],[],'hist',app.PredictorVarNames);
gplotmatrix(app.UIAxes4,app.Predictors,[],[],[],[],[],[],'hist',app.PredictorVarNames);
Anybody know what might be going on ?
I have separate matlab script which I used to test the variables. That one draws the figure perfectly.
I also tried to fix the gplotmatrix on the panel with set command -
h=gplotmatrix(CmatData,[],[],[],[],[],[],'hist',CorMatNames);
set(h,'Parent',app.Panel_2);
it may not be possible or the way I am trying to do this is wrong. The lines above, when used in app, draws the gplotmatrix as pop up window correctly.
Any help - highly appreciated ...
Antti Heikkinen
0 commentaires
Réponse acceptée
Adam Danz
le 24 Mai 2021
Modifié(e) : Adam Danz
le 24 Mai 2021
Cause of the error
Always share the entire error message when asking how to fix the error.
For now I'll assum you received an error similar to this one (R2021a),
Error using matlab.ui.Figure/set
Functionality not supported with figures created with the uifigure function.
Error in gplotmatrix (line 401)
set(figparent,'NextPlot','replace')
Error in MyFunction (line 15)
gplotmatrix(uip,X,[],group,color,[],[],[],'grpbars',xnames)
The second line indicates that some process that gplotmatrix relies on does not accept figtures created with uifigure which is the figure-type used in AppDesigner.
If you received a different error message, add that to your question or as a comment under your question and we can work from there.
Workaround
One workaround would be to produce the gplotmatrix in a panel within an independent figure and then move the panel to your app figure after its rendered.
Basic steps,
% Produce a UIFigure with a UIPanel (this will already exist in your app)
app.UIFigure = uifigure();
app.UIPanel = uipanel(app.UIFigure);
% Produce gplotmatrix in an external, hidden figure
tempfig = figure('visible','off');
cleanupFig = onCleanup(@()delete(tempfig));
tempUIPan = copyobj(app.UIPanel, tempfig);
data = load('fisheriris.mat');
gplotmatrix(tempUIPan,data.meas,[],data.species);
drawnow
% Move invisible
h = copyobj(tempUIPan.Children, app.UIPanel);
delete(tempfig) % Delete hidden figure

4 commentaires
Adam Danz
le 25 Mai 2021
Oh, good. I wasn't sure whether the gplotmatrix options you were using (the hist option) would affect the workaround or not.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!