diff --git a/src/matlab-example.m b/src/matlab-example.m new file mode 100644 index 0000000..5a5d85d --- /dev/null +++ b/src/matlab-example.m @@ -0,0 +1,28 @@ +% Turn on the diary to start logging output to a file +diary('console_output.txt') + +% Define the size of the matrices +n = 4; + +% Generate two random matrices A and B of size n x n +A = rand(n); +B = rand(n); + +% Multiply the two matrices +C = A * B; + +% Compute the eigenvalues of the resulting matrix C +eigenvalues = eig(C); + +% Optionally, print the matrices and the eigenvalues to the MATLAB console +disp('Matrix A:'); +disp(A); +disp('Matrix B:'); +disp(B); +disp('Product Matrix C:'); +disp(C); +disp('Eigenvalues of Matrix C:'); +disp(eigenvalues); + +% Turn off the diary to stop logging +diary off \ No newline at end of file diff --git a/src/matlab-slurm.sh b/src/matlab-slurm.sh index b7328bf..5b7149a 100755 --- a/src/matlab-slurm.sh +++ b/src/matlab-slurm.sh @@ -20,4 +20,4 @@ module list # -nojvm : Tells Matlab to run without the Java Virtual Machine to reduce overhead # test.m : Matlab commands file -srun matlab -nodisplay -nodesktop -nojvm < test.m +srun matlab -nodisplay -nodesktop -nojvm < matlab-example.m