I'm currently using the following code to write the entries of matrix X onto a .txt file:
fprintf(fileID,['%12.6f %12.6f \r\n'],X);
As is, the .txt file stores the entries as decimals. I'm looking for a way to store the entries as fractions instead of decimals. I've been trying to use the rats function for the matrix X but haven't found a solution.
For example, X = [1.250000 0.333333; 0 0.142857]. I want to store this as
5/4 1/30 1/7
in my .txt file. Would appreciate help.
Thanks in advance!
Best Answer