Description: |
The API to get the number of rows in a CSV file always returns the maximum number of elements in any given row as the size.
Ex:
Consider the following as the content of the CSV file.
SYSTEM SIGNAL NUMBER VALUE
R1 X 60 13
R2 Y 61 14 9 8 7
When the get row API is used to gets the content of the row in the current index, the entire content is returned as a list.
Considering the index is in the 2nd row, i.e, at X, the get row API returns list1 as
R1 X 60 13 followed by 3 spaces ({} {} {})
and when the index is at Y the get row api returns list2 as
R2 Y 61 14 9 8 7
However the length of both the lists are now 7.
The length of the first list (list1) should it not be 4?
Please check.
|
User Comments: |
aku added on 2017-05-30 16:55:39:
(text/x-fossil-wiki)
This actually depends on how you created the matrix form the CSV file.
I suspect that you used <a href="https://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/csv/csv.html#5"><strong>read2matrix</strong></a>
with the <strong>expand</strong> argument set to <strong>auto</strong>.
In this mode the reader automatically expands the matrix to fit the max number of columns found in the file.
You could try the other modes to see if they are more suitable.
Generally note that a matrix is a table, like in a database. Each row will have the same number of columns, even if some are empty. A matrix where each row has a different number of columns is not supported, and I do not intend to support that.
Does this help ?
|