ResearchOS / Biomech-Analysis-Platform-MATLAB

A GUI-based operating system framework to facilitate biomechanical data analysis. This platform attempts to manage the non-scientific part of coding without restricting the direction or method of scientific analysis.
MIT License
4 stars 0 forks source link

Convert Settings struct variables to json when saving, and vice versa when loading. #141

Closed mtillman14 closed 12 months ago

mtillman14 commented 1 year ago

This will help with 1. Human readability, 2. GitHub syncing, 3. Future translation between MATLAB and Python, 4. Future-proofing.

Need to then interpret the variables that "jsondecode" creates in MATLAB because it will not be the exact same data types.

mtillman14 commented 1 year ago

Not only is it better for documentation and whatnot, it's also much faster to encode the MAT files as json, then just save the json files. Also faster on the flipside, when loading those json files and converting decoding them back to MAT files. See below code: % Encode the Digraph variable to json and save it to file. tic; plotJS=jsonencode(Digraph,PrettyPrint=true); fid=fopen('TestDigraphJSON.txt','w'); fprintf(fid,'%s',plotJS); fclose(fid); toc;

% Time to load the Digraph variable tic; load('Settings_Spr22RoleOfEachGaitPhase.mat','Digraph'); toc;

% Time to load the json of the Digraph, then convert it to struct. tic; text=fileread('TestDigraphJSON.txt'); Digraph2=jsondecode(text); toc;

mtillman14 commented 12 months ago

SQL now