Unrecognized property 'fig' for class 'matlab.ui.Figure'.

5 Ansichten (letzte 30 Tage)
Amro Alsabbagh
Amro Alsabbagh am 6 Dez. 2021
Kommentiert: Steven Lord am 7 Dez. 2021
Hello all,
In my code, I have the following:
h.fig = figure('Units','normalized','position',[0.269531 0.304688 0.642578 0.546875],...
'resize','on','tag','mattran.datapan1',...
'menubar','None','name',call,...
'numbertitle','Off','visible','off',...
'deletefcn','matgate(''closeall''); ','color',[1 1 1] );
and I am having the below error:
Unrecognized property 'fig' for class 'matlab.ui.Figure'.
Error in datapan (line 15)
h.fig = figure('position',[0.269531 0.304688 0.642578 0.546875],...
Any idea how to solve it?

Antworten (1)

Steven Lord
Steven Lord am 7 Dez. 2021
You'd already stored a figure handle in the variable named h, and indeed a Figure handle doesn't have a property named fig like you're trying to assign into.
  2 Kommentare
Amro Alsabbagh
Amro Alsabbagh am 7 Dez. 2021
Below is the previous command:
h= findobj(get(0,'children'),'flat','tag','SS.goo1');
close(h);
%+figure creation
h.fig = figure('Units','normalized','position',[0.269531 0.304688 0.642578 0.546875],...
'resize','on','tag','mattran.datapan1',...
'menubar','None','name',call,...
'numbertitle','Off','visible','off',...
'deletefcn','matgate(''closeall''); ','color',[1 1 1] );
Steven Lord
Steven Lord am 7 Dez. 2021
Figures don't have a property named fig and that is the reason why you received the error.
Store that figure handle in a different variable or in another element of the array h.
f(1) = figure;
f(2) = figure;
f(3) = figure
f =
1×3 Figure array: Figure Figure Figure
f(4) = figure
f =
1×4 Figure array: Figure Figure Figure Figure

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by