ILNumerics Ultimate VS

ILMathcsvreadT Method (Stream, Int32, Int32, NullableInt32, NullableInt32, FuncString, T, String, CultureInfo, Encoding, Boolean)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Reads comma separated values from stream, optionally using custom separators, element and number formats.

[ILNumerics Computing Engine]

Namespace:  ILNumerics
Assembly:  ILNumerics.Computing (in ILNumerics.Computing.dll) Version: (5.5.7503.3146)

public static RetArray<T> csvread<T>(
	Stream stream,
	int startRow = 0,
	int startCol = 0,
	Nullable<int> endRow = null,
	Nullable<int> endCol = null,
	Func<string, T> elementConverter = null,
	string elementSeparator = ",",
	CultureInfo culture = null,
	Encoding encoding = null,
	bool leaveStreamOpen = false


Type: System.IOStream
Stream with CSV data in lines.
startRow (Optional)
Type: SystemInt32
[Optional] Start reading the values from that row. Default: 0.
startCol (Optional)
Type: SystemInt32
[Optional] Start reading values from that column. Default: 0.
endRow (Optional)
Type: SystemNullableInt32
[Optional] Index of the last row to take into account. Default: last row in stream.
endCol (Optional)
Type: SystemNullableInt32
[Optional] Index of the last column to take into account. Default: last column in stream.
elementConverter (Optional)
Type: SystemFuncString, T
[Optional] Custom function to convert each element from its string representation. Default: parse as Double.
elementSeparator (Optional)
Type: SystemString
[Optional] String separating individual elements. Default: , (comma)
culture (Optional)
Type: System.GlobalizationCultureInfo
[Optional] Number format used while parsing individual elements. Default: invariant culture (not current thread culture!)
encoding (Optional)
Type: System.TextEncoding
[Optional] Encoding used to read bytes from stream. Default: ASCII encoding.
leaveStreamOpen (Optional)
Type: SystemBoolean
[Optional] If set to true stream will not be closed by this method. Default: false.

Type Parameters

Element type to return.

Return Value

Type: RetArrayT
Matrix with elements read from stream.

The data lines in stream are parsed using elementSeparator as element separator. Arbitrary element types T can be parsed by providing a customized function elementConverter for parsing individual elements. The current threads culture is temporarily changed to use the number format info provided in culture. The number format of the given culture provides the parser with info about decimal separators among others used to determine number formats for parsing.

[ILNumerics Computing Engine]

See Also