Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский
Scilab Help >> Files : Input/Output functions > mputl


writes strings in a text file


r = mputl(txt, file_desc)



returns %t or %f to check if function has correctly wrote on the file.


a character string giving the name of the file or

an integer scalar: a file descriptor returned by mopen function.


a vector of strings.


mputl function allows to write a vector of strings as a sequence of lines in a text file.

mputl supports strings encoded as ANSI/ASCII and UTF-8.


fd = mopen(TMPDIR+'/text_mputl.txt','wt');
mputl('Hello World',fd);

mputl('Simple Hello World',TMPDIR+"/text_mputl_simple.txt");

fd = mopen(TMPDIR+'/text_mputl.txt','rt');

See also

  • mget — parses numbers in a binary file and returns them as decimals
  • mgetl — reads lines from an text file
  • mclose — closes opened files
  • mfprintf — converts, formats, and writes data to a file
  • mput — writes byte or word in a given binary format
  • mputstr — write a single text in an open file
  • mopen — opens files in Scilab
  • write — write in a formatted file


Author : posted the 09/02/2011 11:45
This is an example of a calling sequence with the filename as input argument.

content = [
"1 2 3 4"
filename = fullfile(TMPDIR,"data.txt");

By the way, the examples should not use the "/" as the delimitor, which is confusing (even if the example works perfectly on Windows).

fd = mopen(fullfile(TMPDIR,'text_mputl.txt'),'wt');
mputl('Hello World',fd);

Reply to this comment
Please login to comment this page

Add a comment:
Please login to comment this page.

Report an issue
<< mput Files : Input/Output functions mputstr >>

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:23:28 CET 2022