[Scilab-users] gcf()

classic Classic list List threaded Threaded
9 messages Options
Stefan Du Rietz Stefan Du Rietz
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] gcf()

Hi,
if there is no figure, gcf() should return an empty handle, shouldn't
it? Now you get a handle to a new default figure, which is opened.
That is the expected (and actual) response from scf().

Is this a bug in gcf()?

Regards
Stefan
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Serge Steer-3 Serge Steer-3
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

Le 26/07/2013 21:55, Stefan Du Rietz a écrit :
> Hi,
> if there is no figure, gcf() should return an empty handle, shouldn't
> it? Now you get a handle to a new default figure, which is opened.
> That is the expected (and actual) response from scf().
>
> Is this a bug in gcf()?
>
It should be a logical choice, but changing the gcf and
get("current_figure") behavior will breaks compatibility.
A solution for testing if there is no figure is to check winsid()==[]

Serge
> Regards
> Stefan
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Adrien Vogt-Schilb Adrien Vogt-Schilb
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

On 26/07/2013 22:42, Serge Steer wrote:
Le 26/07/2013 21:55, Stefan Du Rietz a écrit :
Hi,
if there is no figure, gcf() should return an empty handle, shouldn't it? Now you get a handle to a new default figure, which is opened. That is the expected (and actual) response from scf().

Is this a bug in gcf()?

It should be a logical choice, but changing the gcf and get("current_figure") behavior will breaks compatibility.
A solution for testing if there is no figure is to check winsid()==[]

Serge
I thought that ==[] should be discouraged.
Then isempty(winsid()) would be a better solution

Adrien

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Stefan Du Rietz Stefan Du Rietz
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

On 2013-07-26 23:29, Adrien Vogt-Schilb wrote:
--------------------

> On 26/07/2013 22:42, Serge Steer wrote:
>> Le 26/07/2013 21:55, Stefan Du Rietz a écrit :
>>> Hi,
>>> if there is no figure, gcf() should return an empty handle,
>>> shouldn't it? Now you get a handle to a new default figure, which
>>> is opened. That is the expected (and actual) response from scf().
>>>
>>> Is this a bug in gcf()?
>>>
>> It should be a logical choice, but changing the gcf and
>> get("current_figure") behavior will breaks compatibility.
>> A solution for testing if there is no figure is to check winsid()==[]
>>
>> Serge
> I thought that ==[] should be discouraged.
> Then isempty(winsid()) would be a better solution
>
> Adrien

That is exactly what I did. ;-)

Stefan
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

In reply to this post by Adrien Vogt-Schilb
Hello,

> De : Adrien Vogt-Schilb
> Envoyé : vendredi 26 juillet 2013 23:29
>
> I thought that ==[] should be discouraged.

For which reason?

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
______________________________________________________________________
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Adrien Vogt-Schilb Adrien Vogt-Schilb
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

On 29/07/2013 10:33, Dang, Christophe wrote:

> Hello,
>
>> De : Adrien Vogt-Schilb
>> Envoyé : vendredi 26 juillet 2013 23:29
>>
>> I thought that ==[] should be discouraged.
> For which reason?
>
> Regards
>
hey
I don't remember!

I remember that in general empty matrices are tricky when used with
booleans, for instance this example displays nothing:

if find([1 2 3]==4)
  disp yes
end

if ~find([1 2 3]==4)
  disp no
end

and is therefore different from this one

if find([1 2 3]==4)
  disp yes
else
  disp no
end

I also vaguely remember that [] counts as true in some languages and
false in some other languages. And that x==[] "should" return false for
any x, but returns true is x is empty in scilab, which is not standard
(if i remember well).
Quite far from the original winsid()==[] (which works fine btw), but the
idea is to get used not to test empty matrices when coding because it's
messy.
(again, I'm not sure about this)

-- Adrien Vogt-Schilb (Cired) +33 (0) 1 43 94 73 83
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

> De la part de Adrien Vogt-Schilb
> Envoyé : lundi 29 juillet 2013 14:40
>
> I also vaguely remember that [] counts as true in some languages and
> false in some other languages.

Thanks for your answer.

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
______________________________________________________________________
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Serge Steer-3 Serge Steer-3
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

In reply to this post by Christophe Dang Ngoc Chan
Le 29/07/2013 10:33, Dang, Christophe a écrit :
> Hello,
>
>> De : Adrien Vogt-Schilb
>> Envoyé : vendredi 26 juillet 2013 23:29
>>
>> I thought that ==[] should be discouraged.
> For which reason?
May be in the future there will be different empty arrays like n by 0
array empty array with data type....
So using isempty may make codes more robust with respect to such evolution.

Serge
>
> Regards
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: gcf()

> De la part de Serge Steer
> Envoyé : lundi 29 juillet 2013 16:19
>
> May be in the future there will be different empty arrays
> [...] So using isempty may make codes more robust

Thanks

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
______________________________________________________________________
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users