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

Philipp Mühlmann p.muehlmann at gmail.com
Tue Apr 5 20:09:39 CEST 2016


thanks...exactly what I was searching for.

2016-04-05 19:14 GMT+02:00 Nicolas Fezans <nicolas.fezans at gmail.com>:

> 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
> >
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



-- 
In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.

There we have the salad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160405/1438a940/attachment.htm>


More information about the users mailing list