Main Content

matlab.indexing.isScalarClass

Determine whether input is scalar class

Since R2024b

    Description

    TF = matlab.mixin.isScalarClass(A) returns logical 1 (true) if A is a function handle or an instance of a class that inherits from matlab.mixin.Scalar. Otherwise, it returns logical 0 (false).

    example

    Examples

    collapse all

    Define a function handle f.

    f = @sin;

    Function handles are scalar by default. Verify that f is a scalar.

    matlab.indexing.isScalarClass(f)
    ans =
    
      logical
    
       1

    Input Arguments

    collapse all

    The function accepts arrays of any size, but it returns false if the input is not scalar. For example, the function returns false for a cell array of function handles, even though the function handles themselves are scalar.

    Version History

    Introduced in R2024b