csvread
Read comma-separated value (CSV) file.
Syntax
M = csvread(filename)
M = csvread(filename, R1, C1)
M = csvread(filename, R1, C1, [R1 C1 R2 C2])
Input argument
filename - a string: filename source.
R1, C1 - nonnegative integer: offset. default : 0, 0
[R1 C1 R2 C2] - nonnegative integer: Starting row offset, starting column offset, ending row offset and ending column offset.
Output argument
M - a double matrix.
Description
M = csvread(filename, R1, C1, [R1 C1 R2 C2]) reads only the data within the range specified by row offsets R1 to R2 and column offsets C1 to C2.
M = csvread(filename, R1, C1) starts reading data at the row and column offsets specified by R1 and C1. For example, R1=0, C1=0 indicates the first value in the file.
To set row and column offsets without defining a delimiter, use an empty character as a placeholder, like M = csvread(filename, 3, 1).
M = csvread(filename) read a comma-separated value (CSV) formatted file into matrix M.
Complex Number Importing: csvread reads each complex number as a single unit, storing it in a complex numeric field.
Valid forms for complex numbers are:
±<real>±<imag>i|j
3.1347-2.1i
±<imag>i|j
-2.1j
Note: Whitespace within a complex number is not allowed; csvread interprets any embedded spaces as field delimiters.
Example
See also
History
1.10.0
initial version
Author
Allan CORNET
Last updated