Imports a binary Excel file (xls) in a matrix variable interactively
[xlsMat] = DI_readxls() [xlsMat] = DI_readxls(path) [xlsMat, exitID] = DI_readxls() [xlsMat, exitID] = DI_readxls(path)
a string, target path for the file selector (OPTIONAL)
a string, name of the matrix which stores the imported data
an integer, exit codes, 0=OK, -1, -2, -3=error codes, see below.
Read data from a binary Excel 95-2003 file (*.xls) and stores it into a matrix variable interactively.
![]() | DI_readxls does not handle data from XML-based Excel files (*.xlsx) of
Excel 2007 and higher! |
![]() | DI_readxls handles doubles only. Strings or missing data are imported as
Nan (Not-a-number, %nan). |
You can commit an optional path to the function. This is used to open the file selector at the committed target path. If you omit it your home directory is set as the target path.
This is the name of the matrix variable which contents the imported data for further processing in Scilab's console or in a script.
The exitID gives a feedback what happened inside the function. If something went wrong xlsMat is always [] (empty). To handle errors in a script you can evaluate exitID's error codes (negative numbers):
0: Everything is OK. Matrix xlsMat was created
-1: User canceled file selection
-2: User canceled parameter dialog box
-3: Cannot read or interpret XLS file
Import Parameter:
The number of the sheet of the Excel file you want to import from. The names of the sheets are not evaluated. The 1st sheet is 1 the 2nd is 2 independent of their names in Excel.
The rows you want to select for import. E.g. "2:5" imports rows 2, 3, 4 and 5. "2:$" starts the import at row 2 and imports all following rows till the last row is reached. ":" means all rows.
The columns you want to select for import. Refer the description of "row range" above for details.
With row and column range you can import a subset of your raw data table for further processing.