View Raw SPL
/*****************************************************************************
*                                                                            *
*   ISSCALAR.SPL Copyright (C) 2010-2020 DSP Development Corporation         *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:      Randy Race                                                  *
*                                                                            *
*   Synopsis:    Returns 1 if input is a scalar                              *
*                                                                            *
*   Revisions:   18 Jul 2010  RRR  Creation                                  *
*                 8 Dec 2020  RRR  logical test                              *
*                                                                            *
*****************************************************************************/

#include 


#if @HELP_ISSCALAR

    ISSCALAR

    Purpose: Returns 1 if input parameter is a scalar

    Syntax:  ISSCALAR(val)

              val - series, scalar or string input

    Returns: The scalar 1 if the input is a scalar, else 0.

    Example:
             isscalar(3i)

             returns 1

    Example:
             isscalar({3i})

             returns 0

    Example:
             isscalar("string")

             returns 0

    Remarks:
             If the input is non-numeric, isscalar returns 0.

    See Also:
             Iscomplex
             Isreal

#endif



/* is input scalar ? */
isscalar(s)
{
        if (argc < 1)
        {
                s = refwindow(w0);
        }

        /* test value for scalar */
        return(IS_SCALAR(s) || IS_LOGICAL(s));
}