M = csvread(filename)
M = csvread(filename, R1, C1)
M = csvread(filename, R1, C1, [R1 C1 R2 C2])
| Parameter | Description |
|---|---|
| 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. |
| Parameter | Description |
|---|---|
| M | a double matrix. |
M = csvread(filename, R1, C1, [R1 C1 R2 C2]) reads only the data within the range specified by row offsetsR1 to R2 and column offsets C1 to C2.
M = csvread(filename, R1, C1) starts reading data at the row and column offsets specified byR1 andC1. 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, likeM = csvread(filename, 3, 1).
M = csvread(filename) read a comma-separated value (CSV) formatted file into matrixM.
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:
| Form: | Example: |
|---|---|
| ± 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.
A = [Inf, -Inf, NaN, 3]; filename = [tempdir(), 'csvread_example.csv']; csvwrite(filename, A); R = csvread(filename)
| Version | Description |
|---|---|
| 1.10.0 | initial version |