|
Dealing with Data / Data formats / FORMAT=MATLAB |
MATLAB is the binary format used by the MATLAB™ software. This can be used in various ways for input of series or matrices on any version of RATS. Depending upon the structure of the file, it can be either a Time Series Database format or an Unlabeled format.
RATS Instructions
|
data(format=matlab) |
read series from MATLAB into memory |
|
store(convert=matlab) |
copy series from MATLAB to RATS format |
|
read(format=matlab) |
read scalars or arrays from MATLAB into memory |
Interface Operations
Data Wizard
You can read series from a MATLAB (*.MAT) file using Data/Graphics>Data (Other Formats).
Series Window and RATS Data File Window
You can import series using File>Import... or the
toolbar button.
Details
read(format=matlab)
Since READ is designed to read matrices, reading MATLAB data is straightforward: if there’s an N× M matrix A on the file, READ A will dimension A as N× M and read the data into it. You can read multiple matrices off a single file. If you’ve saved scalars on the file, you can read those as well.
data(format=matlab)
store(convert=matlab)
Data series will typically be stored in one of two ways: as separately named column vectors, or as a single matrix with multiple columns. Either way, RATS will not recognize any dates on the file. If the data are in separate columns, read them by name. For the arrangement with multiple columns, use the option SHEET=matrix name, then give series names to the columns.
Examples
The file CBES.MAT has one matrix named PSID. This has 3051 rows by 3 columns. The columns represent (in order) age, education and income. The following will read the data from that file and create three series:
open data cbes.bat
data(format=matlab,sheet="psid") 1 3051 age education income
The file USMODEL_DATA.MAT has seven column matrices with names DC, DINVE, DY, LABOBS, DW, PINFOBS and ROBS. Each column has 230 entries, representing quarterly data from 1950Q1 to 2007Q2. The following reads data from the file:
open data usmodel_data.mat
calendar(q) 1950:1
data(format=matlab) 1950:01 2007:02 dc dinve dy labobs dw $
pinfobs robs
Copyright © 2026 Thomas A. Doan