How to use Matlab to create dfs2 file from Ascii (text) file?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Harr
le 23 Déc 2022
Commenté : Walter Roberson
le 28 Déc 2022
Hello!
Is if possible to use any code for changing Ascii (text) file to create dfs2-file (described here) for DHI's Mike Modeling tools?
I have attached 2 examples of those Ascii files.
Currenlty it is possible to change Ascii files (single file) to dfs2 file format in Mike Zero toolbox by DHI! I dont see it efficient at all and it will be great if Matlab can handle this task instead!
Best regards!
/Harr
0 commentaires
Réponse acceptée
Walter Roberson
le 28 Déc 2022
Modifié(e) : Walter Roberson
le 28 Déc 2022
https://docs.mikepoweredbydhi.com/core_libraries/dfs/dfs-file-formats/ does not describe the details of the file format. It does tell you the name of functions to invoke through the C api or the .NET api. The C api would require a compiler but could be used with any of the supported operating systems. The .NET api would require MS Windows
As Mike's code is likely already using the same functions, I would not expect having matlab invoke the routines would be any faster.
2 commentaires
Walter Roberson
le 28 Déc 2022
When developers write code to convert files between formats, then developers almost always use their existing routines to read and write the relevant file formats. When they do not do that, when they write specific conversion code, the reasons almost always have to do with shortcuts that can be taken, such as mechanical reformatting that can be done without having to "understand" the data. So the developer-provided conversion routines are almost always as good as or faster than using the developer-provided reading and writing routines.
The exception to this situation is that sometimes when a developer writes a conversion routine, the developer puts in a bunch of sanity checks and cross-checks, or facilities intended to help examine and understand the details of what is happening. Like asking "Does it make sense that there is a non-zero force in the matrix between node 3 and node 7? No! Node 18 is physically between the two and would block the force!" Routines that validate and repair input files while converting to output files can be very useful... but take longer. So occasionally you can get better performance by using the developer provided reading and writing (without validation) routines... but not typically.
What MATLAB might provide is convenience -- an interface that makes it easier to invoke the developer-provided functions on a series of files. Not "efficiency", not unless you are talking about user-time instead of processing time, but convenience .
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!