ILNumerics - Technical Application Development
Assembly: ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Matrix with elements read from csvData.
Reads comma separated values from lines in a string, optionally using custom separators, element and number formats.
[ILNumerics Computing Engine]
Namespace: ILNumerics
Assembly: ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax
public static RetArray<T> csvread<T>( string csvData, int startRow = 0, int startCol = 0, Nullable<int> endRow = null, Nullable<int> endCol = null, Func<string, T> elementConverter = null, string elementSeparator = ",", CultureInfo culture = null )
Parameters
- csvData
- Type: SystemString
String 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 csvData. - endCol (Optional)
- Type: SystemNullableInt32
[Optional] Index of the last column to take into account. Default: last column in csvData. - 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!)
Type Parameters
- T
- Element type to return.
Return Value
Type: RetArrayTMatrix with elements read from csvData.
Remarks
The data lines in csvData is 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 provides the parser with info about decimal separators among others used to determine number formats for parsing.
[ILNumerics Computing Engine]
See Also