{"id":22897137,"url":"https://github.com/kovacsgg/mat4js","last_synced_at":"2025-05-07T22:06:10.281Z","repository":{"id":38240794,"uuid":"281228789","full_name":"KovacsGG/mat4js","owner":"KovacsGG","description":"JavaScript library to load Matlab Level 5 MAT-files as JavaScript objects and vice versa","archived":false,"fork":false,"pushed_at":"2024-10-01T13:50:43.000Z","size":780,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-09T07:43:47.498Z","etag":null,"topics":["javascript","javascript-library","mat-files","matlab"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KovacsGG.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":"2020-07-20T21:25:06.000Z","updated_at":"2024-11-14T15:11:44.000Z","dependencies_parsed_at":"2024-07-12T03:45:33.144Z","dependency_job_id":"590f3b9c-bbf9-4e6d-8303-5d23a0708cfe","html_url":"https://github.com/KovacsGG/mat4js","commit_stats":{"total_commits":46,"total_committers":3,"mean_commits":"15.333333333333334","dds":0.06521739130434778,"last_synced_commit":"4195083d40a6bf42de805a871e254b0056152966"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KovacsGG%2Fmat4js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KovacsGG%2Fmat4js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KovacsGG%2Fmat4js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KovacsGG%2Fmat4js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KovacsGG","download_url":"https://codeload.github.com/KovacsGG/mat4js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229629360,"owners_count":18101275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["javascript","javascript-library","mat-files","matlab"],"created_at":"2024-12-14T00:15:31.213Z","updated_at":"2024-12-14T00:15:31.836Z","avatar_url":"https://github.com/KovacsGG.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mat4js\nJavaScript library to load Matlab Level 5 MAT-files as JavaScript objects.\nBased on the documentation: https://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf released for 2019b\n\n## Installation\n### via npm\n```\n$ npm install mat-for-js\n```\n\nthen use as\n\n```js\nimport { read as readmat } from \"mat-for-js\"\nreadmat(ArrayBuffer)\n```\n\n```js\nimport * from \"mat-for-js\"\nmat4js.read(ArrayBuffer)\n```\n\n### via script tag\nDownload `dist/mat4js.read.min.js` to your webserver and include it in your HTML:\n```html\n\u003cscript type=\"text/javascript\" src=\"./mat4js.read.min.js\"\u003e\u003c/script\u003e\n```\n\n## Read\nUse `mat4js.read(ArrayBuffer)`.\n\nIt returns a JavaScript object with a `.header` and `.data` property.\n\n#### `.header`\ncontains 116 bytes of text.\n\nPadding characters are not truncated.\n\n#### `.data`\nis an object containing the named arrays in the file. (`{name: content}`)\n\nMatlab stores vectors as 2D but flat arrays (1xn or nx1). These are converted to plain 1D arrays (`[1, 2, 3]` instead of `[[1, 2, 3]]`) or strings in case of character arrays. In multidimensional character arrays the characters are not concatenated to form strings, but are kept separate. (`{char_array: [[\"a\", \"b\", \"c\"], [\"d\", \"e\", \"f\"]]}` instead of `{char_array: [\"abc\", \"def\"]}`)\n\nNumeric arrays with `Int64` or `Uint64` data types are converted into an array of `BigInt`.\n\nNumeric arrays with imaginary component are converted into an array of objects with `.r` and `.i` properties for the real and imaginary components respectively.\n\nScalar structs are converted into objects as would be expected, while non-scalar structs are more akin to cell arrays. For a struct constructed with\n\n```\nS = struct()\nS.cell = {1 2; 3 4}\nS.fruit = 'apple'\n```\n\nIn JavaScript\n\n```js\nS.cell[1][0] == 3\nS.fruit == \"apple\"\n```\n\nBut for one constructed with `S = struct('cell', {1 2; 3 4}, 'fruit', 'apple')` (non-scalar):\n\n```js\nS[1][0].cell == 3\nS[1][1].cell == 4\nS[1][0].fruit == \"apple\"\nS[1][1].fruit == \"apple\"\n```\n\nand `S.fruit == \"apple\"` is not accessible.\n\nSparse arrays are converted to objects with `.x` and `.y` properties describing the width and height of the array respectively, and an `.nz` property containing an array of objects representing non-zero values. These objects also have `.x` and `.y` properties for their indices in the matrix and an additional `.v` for the non-zero value at the index.\n\n## Build\nIf you want to rebuild `dist/readmat.min.js`, first install the dev dependencies with `npm install`.  Once `webpack` is installed, run `npm run build`.\n\n## Limitaions\nThere is no support for Object array types.  64-bit integer type support depends on using a version of JavaScript that includes the `DataView.getBigInt64()`/`DataView.getBigUint64()` methods.\n\nMatlab v7.3 MAT-files use HDF5 data structure and are not supported. Reading such files will throw a `FeatureError` with the `.feature` property set to `\"HDF5\"`. There are other JavaScript projects to view HDF5 files: https://github.com/usnistgov/jsfive\n\nThere is no write functionality.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkovacsgg%2Fmat4js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkovacsgg%2Fmat4js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkovacsgg%2Fmat4js/lists"}