Package jline.util
Class MatFileUtils
-
- All Implemented Interfaces:
public class MatFileUtils
Utility class for saving matrices and workspaces to MATLAB .mat files using the MFL (MATLAB File Library) for Java.
-
-
Constructor Summary
Constructors Constructor Description MatFileUtils()
-
Method Summary
Modifier and Type Method Description static void
saveMatrix(Matrix matrix, String variableName, String filename)
Saves a single matrix to a . static void
saveWorkspace(Map<String, Matrix> matrices, String filename)
Saves multiple matrices to a . static void
saveCTMCWorkspace(Matrix stateSpace, Matrix infGen, Matrix pi, String filename)
Saves CTMC solver workspace to a . static String
genFilename(String prefix)
Generates a timestamp-based filename for . static String
getWorkspaceDirectory()
Determines the appropriate workspace directory based on the runtime context static void
ensureDirectoryExists(String filename)
Ensures the directory exists for the given filename static void
ensureWorkspaceDirectoryExists()
Ensures the appropriate workspace directory exists -
-
Method Detail
-
saveMatrix
static void saveMatrix(Matrix matrix, String variableName, String filename)
Saves a single matrix to a .mat file
- Parameters:
matrix
- The matrix to savevariableName
- The name of the variable in the .filename
- The output filename
-
saveWorkspace
static void saveWorkspace(Map<String, Matrix> matrices, String filename)
Saves multiple matrices to a .mat file as a workspace
- Parameters:
matrices
- Map of variable names to matricesfilename
- The output filename
-
saveCTMCWorkspace
static void saveCTMCWorkspace(Matrix stateSpace, Matrix infGen, Matrix pi, String filename)
Saves CTMC solver workspace to a .mat file
- Parameters:
stateSpace
- The state space matrixinfGen
- The infinitesimal generator matrixpi
- The steady-state probability vectorfilename
- The output filename
-
genFilename
static String genFilename(String prefix)
Generates a timestamp-based filename for .mat files in the appropriate workspace directory
- Parameters:
prefix
- The prefix for the filename- Returns:
A filename with timestamp in the appropriate workspace directory
-
getWorkspaceDirectory
static String getWorkspaceDirectory()
Determines the appropriate workspace directory based on the runtime context
- Returns:
The workspace directory path relative to the JAR location
-
ensureDirectoryExists
static void ensureDirectoryExists(String filename)
Ensures the directory exists for the given filename
- Parameters:
filename
- The filename to create directory for
-
ensureWorkspaceDirectoryExists
static void ensureWorkspaceDirectoryExists()
Ensures the appropriate workspace directory exists
-
-
-
-