Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.1 - 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 >> Spreadsheet > csvTextScan


Convert a comma-separated value to a matrix

Calling Sequence

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)



a m-by-1 or 1-by-m matrix of strings.


a 1-by-1 matrix of strings, the column separator mark.


a 1-by-1 matrix of strings, the decimal mark. The available values are "." or ",".

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


a 1-by-1 matrix of strings, the type of the output A. Available values are "string" or "double".


a 1-by-4 or 4-by-1 matrix of floating point 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.


a m-by-n matrix of strings or double.


Given an ascii file with delimited fields, this function returns the corresponding Scilab matrix of strings or doubles.

The csvTextScan function has the same purpose as csvRead, except that csvTextScan reads in a string, while csvRead reads in a file.

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

Any optional input argument equal to the empty matrix [] is set to its default value.

When input argument "conversion" is equal to "double", strings are converted as NaN.


// 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


5.4.0 Function introduced. Based on the 'csv_readwrite' module.
5.4.1 If decimal is different of [] and conversion is set to string, the decimal conversion will be done.
Report an issue
<< csvRead Spreadsheet csvWrite >>

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:
Thu Oct 02 13:47:01 CEST 2014