Last active
April 1, 2022 04:54
-
-
Save mvanzulli/59227c63f5fb76c9556630f96380a3ab to your computer and use it in GitHub Desktop.
Function to create a .tex latex input exporting codes parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [] = texDataGenSDCantBeam( printParams, example ) | |
%Compute output directory | |
texFolderPath = ['./../../../tex/']; | |
%Name of the file | |
nameExampleFileVals = ['valsExample' num2str(example) ]; | |
% Write values of the example | |
% open file | |
exampleTexFile = fopen( [ texFolderPath nameExampleFileVals '.tex' ] ,'w') ; | |
% introduce example name | |
problemName = 'exampleName'; | |
% Read print params list | |
paramNames = fieldnames(printParams) ; | |
for paramIndex = 1:length( paramNames ) | |
nameParam = paramNames{ paramIndex } ; | |
valueParam = getfield(printParams, nameParam) ; | |
fprintf(exampleTexFile, [ '\\newcommand{\\' problemName nameParam '}{' num2str(valueParam) '}' '\n' ] ) ; | |
end | |
% close file | |
fclose(exampleTexFile); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment