I have a matlab code which is gui based. I am using this code in Matlab 2019b for the first time. The code works in 2017a. below are the errors I am getting:
Error using handle.handle/get
Invalid or deleted object.
Error in centerfig>localPlaceHGFig (line 95)
f1u = get(F1,'Units');
Error in centerfig (line 27)
xy = localPlaceHGFig(F1,F2);
Error in step0 (line 53)
'Position',centerfig([0.330078 0.391927 0.341797 0.13875])...
What does these mean? the code worked fine in 2017a version. I must also say I am now running this code on my laptop instead of a desktop computer. Is the 'Position' an issue?
Thank you

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日

0 投票

It shows that the graphic object you are trying to change is already deleted. I think that you accidentally closed the figure window and then run these lines of code. Try to rerun this code after closing all the figures currently opened and cleaning the workspace
close all
clear

4 件のコメント

Curious Mind
Curious Mind 2020 年 4 月 5 日
Thank you for your response.
I have another error if you can help?
Error using waitfor
Unrecognized function or variable 'new_wk'.
The code is shown below
T = uicontrol(fig,...
'Style', 'Push',...
'BackgroundColor', [.8 1 .8],...
'units', 'normalize',...
'Position', [0 .666 1 .334],...
'String', 'Create new',...
'Callback', 'new_wk;'...
Another error is :
Error using step1 (line 101)
Error while evaluating UIControl Callback.
code is shown below
waitfor(fig);
clear T M ui_help ans;
Thanks!
Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日
These error are related to callback functions. Do you have a function named new_wk? This line
'Callback', 'new_wk;'...
is specifying a callback function named new_wk.
Curious Mind
Curious Mind 2020 年 4 月 5 日
thanks! would it be an m-file? something like new_wk.m? or just a function
Ameer Hamza
Ameer Hamza 2020 年 4 月 5 日
Yes, It shoule be a seperate file named new_wk.m.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2019b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by