[Scilab-users] check if variable within structure is available

Nicolas Fezans nicolas.fezans at gmail.com
Tue Apr 5 19:14:18 CEST 2016


Hi,

just use:

isfield(handles, 'I_RES')

for that. You might want to check whether "handles" exists before
making that test, if you want to be sure that your program won't abort
execution with a non-treated error, if "handles" does not exist.


Nicolas

On Tue, Apr 5, 2016 at 3:26 PM, Philipp Mühlmann <p.muehlmann at gmail.com> wrote:
> Is there a way to check if a variable within a structure is available?
>
>
> Example:
>
> There is a structure   handle  containing different variables.
>
>
> e.g:
>
> handles.status     // contain Status info of different pushbuttons --> in
> fact status is a structure itself:  handles.Status.pb1; handles.Status.pb2;
> handles.I_ORG   // contains original Image --> array
> handles.I_RES    // contains resulting Image  --> array
>
>
> Now I want to check if  handles.I_RES existst
>
>
>
> exists('handles.I_RES' , 'a')    will return "0" even if handles.I_RES does
> exist
> isdef  ('handles.I_RES' , 'a')    will return "F" even if handles.I_RES does
> exist
>
>
> Thank you,
> Philipp
>
> --
> In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.
>
> There we have the salad.
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



More information about the users mailing list