Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - 日本語

Change language to:
English - Français - Português - Русский

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

Scilabヘルプ >> Console > %onprompt

%onprompt

special custom function called after each line execution in console

Description

If it is defined, the function %onprompt()

  • must be written in Scilab language.
  • expects no explicit input argument.
  • assigns to ans its first explicit output argument (if any).

Then, %onprompt() is automatically executed after the historization and the execution of each row of instructions entered in the console (even if it is only a comment).

If an output argument is defined, ans is displayed even if a semi-colon is appended to the row of instructions. Other explicit output arguments (if any) are ignored.

  • %onprompt() may be (re)defined at any execution level.
  • If some diaries are open and %onprompt() displays some contents in the console, these ones are recorded in the diaries with all other console outputs.

Examples

// Redisplaying the last line of instructions after its execution:
function %onprompt()
    mprintf("%s\n", gethistory()($));
endfunction
a = grand(3,5,"uin",-9,9), b = %pi;
// This is a comment
--> a = grand(3,5,"uin",-9,9), b = %pi
 a  =
   0.  -5.  -9.   5.   3.
  -9.   5.  -9.  -4.   8.
   2.  -5.  -6.   6.   0.

 b  =
   3.1415927

a = grand(3,5,"uin",-9,9), b = %pi

--> // This is a comment
// This is a comment

--> 

See also

  • prompt — カレントのプロンプトを取得/設定
  • ans — 答え
  • gethistory — Scilab履歴を文字列行列に取得
  • startup files — スタートアップファイル
Report an issue
<< lines Console prompt >>

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:
Mon Feb 12 23:12:43 CET 2018