Data: Connect Multiple Files
Create data connection to multiple files
Minimum Origin Version Required: 2020b
1. string fname$="C:\examples\Gasoline 1.mat%(CRLF)C:\examples\Gasoline 2.mat%(CRLF)C:\examples\Gasoline 3.mat";
files2dc dc:=MATLAB;
2. files2dc dc:=CSV fname:="%Ytest2.csv%(CRLF)%Ytest1.csv" samebk:=1 dlg:=1;
3. files2dc dc:=CSV src:=1 path:=%YData samebk:=1;
4. files2dc dc:="Import Filter" fname:="%YS32-014-04.dat%(CRLF)%YS21-235-07.dat%(CRLF)%YS15-125-03.dat" samebk:=1;
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Data Connector | dc |
Input string |
|
Specify the file type of Data Connector. |
Source | src |
Input int |
|
Specify the source of files to be imported. Two options are available:
|
File Names | fname |
Input string |
|
Specify the files to be imported. Full path should be included. |
Folder | path |
Input string |
Availabel when Source is set to Files in Specified Folder. Specify the folder path. | |
Same Book | samebk |
Input int |
|
This checkbox is available if the selected Connector type supports importing multiple files in the same workbook, CSV Connector for example. |
Open Dialog for First File | dlg |
Input int |
|
Whether to open the Selection dialog for the first file. |
This X-Function is used to connect to multiple files at a time. Currently limited connector types are supported: CSV, Excel, MATLAB, HDF, NetCDF Connectors + Import Filter for workbook; Matlab, HDF, and NetCDF Connectors for matrix. The dialog supports choosing specified files or all files in a specified folder. For some types like the CSV Connector, you can specify the import of multiple files into the same workbook. You do this by selecting Open Dialog for First File which opens the Connector dialog allowing you to specify the import settings. All remaining files will follow these settings.