Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Português - 日本語 - Русский
Aide de Scilab >> Entrées/Sorties [fichiers] > mgetl


reads lines from an text file


txt = mgetl(file_desc [,m])



a character string giving the file name or an integer giving a logical unit returned by mopen.


an integer scalar: a number of lines to read. Default value is -1.


a column vector of strings.


mgetl function allows to read a lines from an text file.

If m is omitted or is -1 all lines till end of file occurs are read.

If m is given mgetl tries to read exactly m lines. This option is useful to sequentially read part of a file. In this case if an end of file (EOF) occurs before m lines are read the read lines are returned (it is possible to check if EOF had occurred using the meof function) issued.

mgetl allows to read files coming from Unix, Windows or Mac operating systems.

mgetl supports only UTF-8 and ANSI file encoding.



mgetl SCI/modules/elementary_functions/macros/erf.sci


See also

  • mputl — writes strings in a text file
  • mclose — closes opened files
  • mfscanf — reads input from the stream pointer stream (interface to the C fscanf function)
  • mget — parses numbers in a binary file and returns them as decimals
  • mput — writes byte or word in a given binary format
  • mgetstr — reads a character string from a file
  • mopen — opens files in Scilab
  • read — matrices read
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:33:07 CET 2022