Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - Français


detectImportOptions

structure containing all useful information to import the file

Syntax

opts = detectImportOptions(filename)
opts = detectImportOptions(filename, OptionName, Value, ...)

Arguments

filename

path or name of file to read

Optional pairs OptionName, Value are:

"Delimiter", string

the column separator mark.

"Decimal", string

the decimal mark, '.' or ','.

"NumHeaderLines", double

the number of header lines.

opts

output argument - structure containing the following information:

variableNames

column names in the file.

variableTypes

data type of each column (double, string, datetime or duration).

inputFormat

data format. The detectImportOptions function tries to determine the input format for datetime and duration data. For others types, no format is to apply.

delimiter

the column seperator.

decimal

the decimal seperator.

datalines

contains the first and last line of file corresponding to data.

header

file header.

emptyCol

contains the number of empty columns.

Description

The detectImportOptions function determines several pieces of information from a file that are useful for reading. This function is used in the readtable and readtimeseries functions.

Examples

opts = detectImportOptions(filename)

Code = ["AF"; "NA"; "OC"; "AN"; "AS"; "EU"; "SA"];
NameContinent = ["Africa"; "North America"; "Oceania"; "Antarctica"; "Asia"; "Europe"; "South America"];
Area = [30065000; 24256000; 7687000; 13209000; 44579000; 9938000; 17819000]; // in km2
NumberCountry = [54; 23; 14; %nan; 47; 45; 12]; 
LifeExpectancy = [60; 78; 75; %nan; 72; 75; 74]; // in years

t = table(Code, NameContinent, Area, NumberCountry, LifeExpectancy, ...
    "VariableNames", ["Code", "NameContinent", "Area", "NumberCountry", "LifeExpectancy"])

// Write the table in CSV file
writetable(t, fullfile(TMPDIR, "data.csv"))

// DetectImportOptions
opts = detectImportOptions(fullfile(TMPDIR, "data.csv"))

r = readtable(fullfile(TMPDIR, "data.csv"), opts)

See also

History

VersionDescription
2024.0.0 Introduction in Scilab.
Report an issue
<< combinations Timeseries/Table groupcounts >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 22 12:54:31 CEST 2025