Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Русский

Change language to:
English - 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 >> Электронная таблица > csvTextScan


Converts into a matrix texts representing separated values


A = csvTextScan(M)
A = csvTextScan(M, separator)
A = csvTextScan(M, separator, decimal)
A = csvTextScan(M, separator, decimal, conversion)
A = csvTextScan(M, separator, decimal, conversion, range)



vector of strings. UTF-8 strings are supported.


a string: the column separator mark.


a string: the decimal mark. The available values are "." or ",".

If decimal is not [] and conversion is set to string, the decimal conversion will be done.


"string" or "double": type of the expected output A. With "double",

  • any input that can't be parsed as a literal number is converted to %nan.
  • literal complex numbers are supported.


vector of 4 decimal integers: the range of rows and columns which must be read (default range=[], meaning that all the rows and columns). Specify range using the format [R1 C1 R2 C2] where (R1,C1) is the upper left corner of the data to be read and (R2,C2) is the lower right corner.


matrix of strings or double, with as many rows as M has components: A(i,:) is the conversion result of M(i).


Given a text matrix with delimited fields, this function returns the corresponding Scilab matrix of strings or of decimal or complex numbers.

To skip an input argument and use its default value, specify [].

The default values of optional input arguments are defined by the csvDefault function.

The csvTextScan and csvRead functions have the same purpose. csvTextScan input are strings, while csvRead reads from a file.


// convert a csv string matrix to splitted string or double matrix
A = ["1;3 + i"; "Nan;-Inf"]
B = csvTextScan(A,';')
C = csvTextScan(A,';',[],'double')
// Configure the decimal mark.
Atext = [
" 1,000000000D+00; 0,000000000D+00; 2,000000000D+02; Inf; 0,000000000D+00";
" 1,000000000D+00; 1,00000000D-300; 2,000000000D+02; Inf; 0,000000000D+00";
" 1,000000000D+00; 1,00000000D-200; 2,000000000D+02; 3,15000000D+300; 1,020000000D+02";
" 9,999999999D-01; 1,00000000D-100; 2,000000000D+02; 2,960000000D+02; 1,170000000D+02";
" 1,000000000D+00; Inf;-Inf; Nan; 0,000000000D+00"
csvTextScan( Atext , ";" , "," )

See also

  • csvRead — Read comma-separated value file


5.4.0 Function introduced. Based on the 'csv_readwrite' module.
5.4.1 If decimal is not [] and conversion is set to string, the decimal conversion will be done.
Report an issue
<< csvRead Электронная таблица csvWrite >>

Copyright (c) 2022-2023 (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:
Tue Feb 25 08:55:07 CET 2020