Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Xcos > Scilab Utilities Functions > block_parameter_error


Displays a parameter input error box for an Xcos block

Calling Sequence

block_parameter_error(inform, expected)



a string, type of error


a string, the expected value or the range of expected values.


The goal of this function is to give a precise information to an user on his error when he inputs a block parameter. The user information is displayed on two lines provided respectively by the parameters:

  • inform: it is reserved to the information for the user on his mistake. The better way to do this is to do a recall of the parameter name and of the wrong value provided by the user.

  • expected: a positive information to guide the user to be in the way of the error correction. By example, if the parameter is an integer, the message may be "Must be an integer", for a range of values we can use a message like that:

    msprintf(gettext("Must be in the interval %s."), "[3, 8]")


The example below is a simple use case for the function. The user inputs a value in the parameter dialog box. If the value is not valid, the example displays this error box:

loadXcosLibs // Useless in Xcos block programming context

ok = %f;

while ~ok do
    // Input the parameter
    [Datatype] = x_mdialog( ..
        "Parameter input", ..
        "Data Type (3:int32, 4:int16, 5:int8, ...) ?", ..
        "3" ..

    if isempty(Datatype) then // Cancel or Ok ?

        Datatype = evstr(Datatype);

    // Test 'Data Type' parameter and displays error box if necessary
    if Datatype < 3 | Datatype > 8 then
        block_parameter_error( ..
            msprintf("Wrong values for ''Data Type'' parameter: %d.", Datatype), ..
            msprintf("Must be in the interval %s.", "[3, 8]") ..
        ok = %f;

    else // Parameter is valid, continue the job
        ok = %t;
        print(%io(2), "Data Type parameter is valid");

See also

  • x_mdialog — Dialog for interactive vector/matrix input.


  • Bernard DUJARDIN
<< Scilab Utilities Functions Scilab Utilities Functions buildouttb >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:10:04 CEST 2011