[Scilab-users] xdel replaced by close()
Stefan Du Rietz
sdr at durietz.se
Sat Jan 22 10:55:44 CET 2022
Hello,
On 2022-01-21 23:54, Samuel Gougeon wrote:
> Hello Claus,
>
> Le 21/01/2022 à 20:58, Claus Futtrup a écrit :
>> Hi Scilabers
>>
>> Today I tried to replace xdel(winsid()) in one of my scripts with
>> close(winsid()) because Scilab shows a warning in the console:
>>
>> Warning: Feature xdel(...) is obsolete and will be permanently removed
>> in Scilab 6.2
>>
>> Warning: Please use close(...) instead.
>>
>> I am negatively surprised that the close() command takes a long time
>> to execute with 5-10 windows open (a few seconds per window). The
>> xdel() command can do it in a split second.
>>
>
> The issue comes not from close() but from the change offindobj() that it
> calls <http://bugzilla.scilab.org/show_bug.cgi?id=13738#c4>, noticeably
> to perform findobj("figure_id",id) in 6.1.1.
> It does not impact only <http://bugzilla.scilab.org/16734> close() for
> this case, that was processed as a special accelerated case
> <https://codereview.scilab.org/#/c/20953/6/scilab/modules/gui/macros/findobj.sci>
> in the former findobj().
>
> This downgradingwas reported
> <http://bugzilla.scilab.org/show_bug.cgi?id=7117#c6> 7 months before
> releasing 6.1.1, and knowingly ignored, while it is perfectly fixable by
> restoring the fast special case.
>
>
>>
>> What is the motivation for replacing xdel with close?
>
> Both do the same thing. Scilab does not need duplicates.
>
> Regards
> Samuel
>
>
scf(id) is much faster than findobj("figure_id",id)
--> winsid()
ans =
0. 1.
--> tic, f = []; for k=winsid(), f = [findobj("figure_id",k); f]; end, toc
ans =
0.281087
--> tic, f = []; for k=winsid(), f = [scf(k); f]; end, toc
ans =
0.000237
So, this is how to do it:
--> for k=winsid(), delete(scf(k)); end
Regards
Stefan
More information about the users
mailing list