{"id":19855907,"url":"https://github.com/cuixing158/serialize-deserialization","last_synced_at":"2026-06-14T10:32:18.946Z","repository":{"id":153929142,"uuid":"631148178","full_name":"cuixing158/Serialize-Deserialization","owner":"cuixing158","description":"matlab struct or struct array Serialize/Deseriali​ze","archived":false,"fork":false,"pushed_at":"2023-04-22T04:55:48.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T23:46:14.074Z","etag":null,"topics":["algorithm","code-generation","matlab","serialization"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuixing158.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-22T04:48:16.000Z","updated_at":"2024-07-27T13:48:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e7f1b51-a1fc-4d02-8c38-a1c96ffdee51","html_url":"https://github.com/cuixing158/Serialize-Deserialization","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cuixing158/Serialize-Deserialization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuixing158%2FSerialize-Deserialization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuixing158%2FSerialize-Deserialization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuixing158%2FSerialize-Deserialization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuixing158%2FSerialize-Deserialization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuixing158","download_url":"https://codeload.github.com/cuixing158/Serialize-Deserialization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuixing158%2FSerialize-Deserialization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34318523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","code-generation","matlab","serialization"],"created_at":"2024-11-12T14:14:04.738Z","updated_at":"2026-06-14T10:32:18.921Z","avatar_url":"https://github.com/cuixing158.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MATLAB struct data serialization for generated code\n\nSupport run-time data saving and loading in the generated code to simplify tricky wrapper calls to low-level functions such as `fread`, `fwrite`, etc. Comparable performance and storage size with commonly used C++ open source serialization libraries (e.g. [boost.Serialization](https://www.boost.org/doc/libs/1_82_0/libs/serialization/doc/index.html),[Cereal](http://uscilab.github.io/cereal/index.html), etc.).\n\n----\n 在生成的代码中支持运行时刻的数据保存和加载，以简化`fread`,`fwrite`等低等级函数的棘手包装调用。与常用的C++开源序列化库（比如[boost.Serialization](https://www.boost.org/doc/libs/1_82_0/libs/serialization/doc/index.html),[Cereal](http://uscilab.github.io/cereal/index.html)等）有可比较的性能和存储大小。\n\n## Features And Limitions\n\n- Support for scalar structure and arrays of structures\n- Support any level of nesting of structures or arrays\n- Support for structure field value base types, `'double', 'single', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'logical', 'char', 'string', ' struct'`\n- The sub-field of a structure or an array supports at most 3-dimensional arrays\n- The field type of a structure or array with the same field name should be consistent\n\n## Compare matlab build-in functions\n\nsome build-in functions:\n\n- `coder.read`,read data files at run time in generated code,it can support C/C++ code generation\n- `coder.write`,write data files that the generated code reads at run time,current R2023a it doesn't support C/C++ code generation\n- `coder.load`, only load MAT-file or ASCII file,doesn't support generated code at run time\n- `load`,only load MAT-file or ASCII file,doesn't support generated code at run time\n- `readstruct`,current only support read structure from \"xml\" file,it doesn't support generated code at run time\n- `writestruct`,current only support write matlab structure to \"xml\" file,it doesn't support generated code at run time\n\nthis project functions\n\n- `readStructBin`,read data files at run time in generated code,current it doesn't support C/C++ generation\n- `writeStructBin`,write data files that the generated code reads at run time,it support C/C++ generation\n\n## Syntax\n\nwriteStructBin:\n\n```matlab\nwriteStructBin(S);\nwriteStructBin(S,configFileName,binaryFileName);\n```\n\nreadStructBin:\n\n```matlab\nS = readStructBin(configFileName,binaryFileName)\n```\n\n## Example\n\nFor example, to save the structure `S1` to the \"data.cfg\" and \"data.stdata\" files in the current working directory. The structure `S1` fields has four types of parameters: \"a\", \"b\", \"c\", \"d\", and the sub-field \"c\" is actually a nested structure with three field names: \"A\", \"B\", and \"C\":\n\n```matlab\nS1 = struct(\"a\",1,...\n\"b\",rand(1,3),...\n\"c\",struct(\"A\",[1,2],\"B\",'matlab_coder',\"C\",rand(5,2)),...\n\"d\",uint8([15,123]));\n```\n\nThen define the description file `configFileName` and the binary file name `binaryFileName` that needs to be saved, the two names are preferably the same except for the suffix, the purpose is to match the subsequent consistency and avoid wrong reads.\n\n```matlab\nconfigFileName = \"data.cfg\";% Available for manual reading\nbinaryFileName = \"data.stdata\";\nwriteStructBin(S1,configFileName,binaryFileName);\n```\n\nAfter a successful write to the file, then execute  `readStructBin` function.\n\n```matlab\nS2 = readStructBin(configFileName,binaryFileName);\n```\n\nAfter successfully reading in the file, you can find that `S1` and `S2` results are the same!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuixing158%2Fserialize-deserialization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuixing158%2Fserialize-deserialization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuixing158%2Fserialize-deserialization/lists"}