Last active
January 13, 2016 17:13
Revisions
-
tbeu revised this gist
Jan 13, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,6 @@ input Boolean append = false "Append values to file"; input String vs = "4" "MATLAB MAT-file version: \"4\" -> v4, \"6\" -> v6, \"7\" -> v7, \"7.3\" -> v7.3"; output Boolean status "true if successful"; external "C" status=ModelicaIO_writeRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2), append, vs) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Save a 2D Real array in a MATLAB MAT-file.</p></html>")); end writeRealMatrix; -
tbeu revised this gist
Jan 13, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ input String matrixName "Name / identifier of the 2D Real array on the file"; input Real matrix[:,:] "2D Real array"; input Boolean append = false "Append values to file"; input String vs = "4" "MATLAB MAT-file version: \"4\" -> v4, \"6\" -> v6, \"7\" -> v7, \"7.3\" -> v7.3"; output Boolean status "true if successful"; external "C" status=ModelicaIO_writeRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2), append, Version) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Save a 2D Real array in a MATLAB MAT-file.</p></html>")); -
tbeu revised this gist
Jan 13, 2016 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,9 +11,8 @@ extends Modelica.Icons.Function; input String fileName "File where external data is stored" annotation(Dialog(loadSelector(filter="MATLAB MAT-files (*.mat)", caption="Open MATLAB MAT-file"))); input String matrixName "Name / identifier of the 2D Real array on the file"; input Integer dim[2] = readMatrixSize(fileName, matrixName) "Number of rows and columns of the 2D Real array"; output Real matrix[dim[1], dim[2]] "2D Real array"; external "C" ModelicaIO_readRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2)) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Read a 2D Real array from a binary MATLAB MAT-file.</p></html>")); end readRealMatrix; -
tbeu created this gist
Jan 13, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ function readMatrixSize "Read dimensions of a 2D Real array from file" extends Modelica.Icons.Function; input String fileName "File where external data is stored" annotation(Dialog(loadSelector(filter="MATLAB MAT-files (*.mat)", caption="Open MATLAB MAT-file"))); input String matrixName "Name / identifier of the 2D Real array on the file"; output Integer dim[2] "Number of rows and columns of the 2D Real array"; external "C" ModelicaIO_readMatrixSizes(fileName, matrixName, dim) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Read the 2D dimensions from a binary MATLAB MAT-file.</p></html>")); end readMatrixSize; function readRealMatrix "Read 2D Real values from file" extends Modelica.Icons.Function; input String fileName "File where external data is stored" annotation(Dialog(loadSelector(filter="MATLAB MAT-files (*.mat)", caption="Open MATLAB MAT-file"))); input String matrixName "Name / identifier of the 2D Real array on the file"; output Real matrix[dim[1], dim[2]] "2D Real array"; protected constant Integer dim[2] = readMatrixSize(fileName, matrixName) "Number of rows and columns of the 2D Real array"; external "C" ModelicaIO_readRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2)) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Read a 2D Real array from a binary MATLAB MAT-file.</p></html>")); end readRealMatrix; function writeRealMatrix "Write 2D Real values to file" extends Modelica.Icons.Function; input String fileName "File where external data is to be stored" annotation(Dialog(saveSelector(filter="MATLAB MAT-files (*.mat)", caption="Save MATLAB MAT-file"))); input String matrixName "Name / identifier of the 2D Real array on the file"; input Real matrix[:,:] "2D Real array"; input Boolean append = false "Append values to file"; input String vs = 4 "MATLAB MAT-file version: \"4\" -> v4, \"6\" -> v6, \"7\" -> v7, \"7.3\" -> v7.3"; output Boolean status "true if successful"; external "C" status=ModelicaIO_writeRealMatrix(fileName, matrixName, matrix, size(matrix, 1), size(matrix, 2), append, Version) annotation(Library={"ModelicaIO", "ModelicaMatIO", "zlib"}); annotation(Documentation(info="<html><p>Save a 2D Real array in a MATLAB MAT-file.</p></html>")); end writeRealMatrix;