Aptech Systems, Inc. Worldwide Headquarters
Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286
Ready to Get Started?
Request Quote & Product Information
Training & Events
Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.
Have a Specific Question?
Q&A: Register and Login
Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.
Join our community to see why our users are considered some of the most active and helpful in the industry!
Where to Buy
Recent Tagsapplications character vectors CML CMLMT Constrained Optimization datasets dlibrary dllcall econometrics error error codes error handling errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation Java API license licensing linux loading data loops matrices matrix manipulation Maxlik MaxLikMT Memory multidimensional array optimization Optmum output panel data PQG graphics procs random numbers strings structures threading writing data
Time Series 2.0 MT
Find out more now
Time Series MT 2.1
Find out more now
Is there a way to retrieve a list of specific file names in a directory?
I would like to have GAUSS get a list of all of the Excel files in a certain directory so that I can iterate over the list and import the data from all of these files. Is there a way to do this?
GAUSS has a command fileSA that will return a list of files matching a certain pattern inside of a separate directory. Suppose that the following files were in the directory C:\gauss13\mydata: unemployment.xls, gdp.xls and inflation.xls then:
xls_files = fileSA("C:\\gauss13\\mydata\\*.xls");
would assign the variable xls_files to be equal to the 3x1 string array:
unemployment.xls gdp.xls inflation.xls
Now you can pass these filenames into the xlsReadM, or xlsReadSA functions to load their contents into GAUSS.
The star character (*) means any number of any characters. Used alone in the place of the file name fileSA will return all files in a directory. For example (using mac style paths):
all_files = fileSA("/Users/myname/gauss13/mydata/*");
will create the variable all_files as an Nx1 string array with one element for each file in the directory /Users/myname/gauss13/mydata