Custom File Class#
RAT enables users to define their own custom files. They can be linked to RAT through Custom File class. Like other classes, the inputs are checked for the right order and type. Also, it uses table data type to store the custom files. Custom files can be added or removed using the methods this class provides.
The custom file table has the following columns:
Name of the row in the Custom File table
Name of the custom file
Language of the custom file
Path of the custom file
If the 4 columns are supplied, a new row (cell array of strings) is made using the supplied inputs. Then, addCustomFile method is used to append the row to the object. This method takes care of the error checking and incrementing the count of the custom files. It also makes a table of the row supplied. This table helps with displaying it properly on terminal.
% Row Name Custom File Name Language Path
problem.addCustomFile('DSPC Model','customBilayer.m','matlab',pwd);
% For C++, function name of the cpp file is supplied
% Row Name DLL/function Name Language Path
problem.addCustomFile('DSPC CPP Model','customBilayer','c++',pwd);
Note
RAT only supports C++ (via dynamic library), MATLAB, and Python.
Reference#
- class API.projectClass.customFileClass(varargin)#
- addCustomFile(varargin)#
Add an entry to the file table. A custom file entry can be added with no parameters, just the name of the custom file entry, the name of the entry alongside a filename, or can be fully defined by specifying the name of the custom file entry, filename, language, file path, and function name. For MATLAB, the provided path must be in the matlab path
customFiles.addCustomFile() customFiles.addCustomFile(‘New Row’) customFiles.addCustomFile(‘New Row’, ‘file.m’) customFiles.addCustomFile(‘New Row’, ‘file.m’, ‘matlab’) customFiles.addCustomFile(‘New Row’, ‘file.py’, ‘python’, ‘C:/stuff’) customFiles.addCustomFile(‘New Row’, ‘file.py’, ‘python’, ‘C:/stuff’, ‘py_function’)
- static addFileExtension(filename, language)#
Adds a file extension to the matlab and python filename if it is missing.
fileWithExt = obj.addFileExtension(‘file’, ‘python’)
- customFileClass(varargin)#
Construct a custom file class containing either an empty table or one with a single row. No input is required for an empty table, otherwise the parameters for the first row should be provided.
customFiles = customFileClass()
- delete()#
Destroys the wrappers
- displayTable()#
Display the file table.
customFiles.displayCustomFileObject()
- setCustomFile(row, varargin)#
Change the value of a given parameter in the file table. The expected inputs are the row of the file entry of interest (given either by name of index), and key-value pairs of the parameter(s) to change. The values of the keys are: “Name”, “Filename”, “Language”, “Path” and “functionName” if applicable.
- customFiles.setcustomFile(1, ‘Name’, ‘New Name’,…
‘Language’, ‘Octave’)
- toStruct()#
Convert the custom files class to a struct
customFiles.toStruct()
- static validateFunctionName(filename, functionName, language)#
Validates a function name is the same as filename for matlab functions if a function name is provided.
funcName = obj.validateFunctionName(‘file.m’, ‘results’, ‘matlab’)
- static validatePath(path)#
Validate a new path exists