Tree @debian/1.9.6+ds-3 (Download .tar.gz)
- .git_filters
- debian
- doc
- meshfix
- sample
- tools
- .gitattributes
- .gitignore
- .gitmodules
- advancefront.m
- affinemap.m
- AUTHORS.txt
- barydualmesh.m
- base64decode.m
- base64encode.m
- bbxflatsegment.m
- binsurface.m
- bwislands.m
- cgals2m.m
- cgalv2m.m
- ChangeLog.txt
- closestnode.m
- Content.txt
- COPYING.txt
- decodevarname.m
- deislands2d.m
- deislands3d.m
- delendelem.m
- deletemeshfile.m
- DESCRIPTION
- dist2surf.m
- edgeneighbors.m
- elemfacecenter.m
- elemvolume.m
- encodevarname.m
- extractloops.m
- extrudecurve.m
- extrudesurf.m
- faceneighbors.m
- fallbackexeext.m
- fast_match_bracket.m
- fillholes3d.m
- fillsurf.m
- finddisconnsurf.m
- flatsegment.m
- gendocs.sh
- getexeext.m
- getintersecttri.m
- getoptkey.m
- getplanefrom3pt.m
- getvarfrom.m
- gzipdecode.m
- gzipencode.m
- highordertet.m
- i2m.m
- i2m.png
- i2m.prj
- imedge3d.m
- img2mesh.fig
- img2mesh.m
- INDEX
- innersurf.m
- insurface.m
- internalpoint.m
- iso2meshver.m
- isoctavemesh.m
- jdatadecode.m
- jdataencode.m
- jload.m
- jnifticreate.m
- jnii2nii.m
- jsave.m
- jsonopt.m
- latticegrid.m
- layersurf.m
- linextriangle.m
- loadbj.m
- loadjnifti.m
- loadjson.m
- loadmsgpack.m
- loadnifti.m
- loadubjson.m
- lz4decode.m
- lz4encode.m
- lz4hcdecode.m
- lz4hcencode.m
- lzipdecode.m
- lzipencode.m
- lzmadecode.m
- lzmaencode.m
- m2v.m
- maskdist.m
- match_bracket.m
- maxsurf.m
- mcpath.m
- memmapstream.m
- mergemesh.m
- mergestruct.m
- mergesurf.m
- mesh2mask.m
- mesh2vol.m
- meshabox.m
- meshacylinder.m
- meshanellip.m
- meshasphere.m
- meshcentroid.m
- meshcheckrepair.m
- meshconn.m
- meshcylinders.m
- meshedge.m
- mesheuler.m
- meshface.m
- meshgrid5.m
- meshgrid6.m
- meshinterp.m
- meshquality.m
- meshrefine.m
- meshremap.m
- meshreorient.m
- meshresample.m
- meshunitsphere.m
- metchgui.fig
- metchgui.m
- metchgui_one.m
- mwpath.m
- ndgaussian.m
- ndimfilter.m
- neighborelem.m
- nestbracket2dim.m
- nifticreate.m
- nii2jnii.m
- niicodemap.m
- niiformat.m
- nodesurfnorm.m
- nodevolume.m
- orderloopedge.m
- orthdisk.m
- outersurf.m
- plotedges.m
- plotmesh.m
- plotsurf.m
- plottetra.m
- polylineinterp.m
- polylinelen.m
- polylinesimplify.m
- proj2mesh.m
- qmeshcut.m
- raysurf.m
- raytrace.m
- readasc.m
- readgts.m
- readinr.m
- README.md
- README.txt
- readmedit.m
- readmptiff.m
- readnifti.m
- readnirfast.m
- readoff.m
- readsmf.m
- readtetgen.m
- regpt2surf.m
- remeshsurf.m
- removedupelem.m
- removedupnodes.m
- removeisolatednode.m
- removeisolatedsurf.m
- rotatevec3d.m
- rotmat2vec.m
- s2m.m
- s2v.m
- saveabaqus.m
- saveasc.m
- savebinstl.m
- savebj.m
- savebnii.m
- savedxf.m
- savegts.m
- saveinr.m
- savejmesh.m
- savejnifti.m
- savejnii.m
- savejson.m
- savemedit.m
- savemphtxt.m
- savemsgpack.m
- savemsh.m
- savenifti.m
- savenirfast.m
- saveoff.m
- savesmf.m
- savestl.m
- savesurfpoly.m
- savetetgenele.m
- savetetgennode.m
- saveubjson.m
- savevrml.m
- slicesurf.m
- slicesurf3.m
- smoothbinvol.m
- smoothsurf.m
- sms.m
- sortmesh.m
- surf2mesh.m
- surf2vol.m
- surf2volz.m
- surfaceclean.m
- surfacenorm.m
- surfboolean.m
- surfdiffuse.m
- surfedge.m
- surfinterior.m
- surfpart.m
- surfplane.m
- surfreorient.m
- surfseeds.m
- surfvolume.m
- thickenbinvol.m
- thinbinvol.m
- TODO.txt
- uniqedges.m
- uniqfaces.m
- v2m.m
- v2s.m
- varargin2struct.m
- vol2mesh.m
- vol2restrictedtri.m
- vol2surf.m
- volface.m
- volmap2mesh.m
- zlibdecode.m
- zlibencode.m
jload.m @debian/1.9.6+ds-3 — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | function varargout=jload(filename, varargin) % % jload % or % jload(fname) % varlist=jload(fname) % [varlist, header]=jload(fname) % varlist=jload(fname,'param1',value1,'param2',value2,...) % % Load variables from a JSON or binary JSON file to a workspace % % authors:Qianqian Fang (q.fang <at> neu.edu) % created on 2020/05/31 % % input: % fname: (optional) input file name; if not given, load 'jamdata.jamm' % if fname has a '.json' or '.jdt' suffix, a text-based % JSON/JData file will be expected; if the suffix is '.jamm' or % '.jdb', a Binary JData file will be expected. % opt: (optional) a struct to store parsing options, opt can be replaced by % a list of ('param',value) pairs - the param string is equivallent % to a field in opt. opt can have the following % fields (first in [.|.] is the default) % % ws ['caller'|'base']: the name of the workspace in which the % variables are to be saved % vars [{'var1','var2',...}]: list of variables to be saved % header [0|1]: if set to 1, return the metadata of the variables % stored in the file % matlab [0|1] if set to 1, use matlab's built-in jsondecode to % parse the json file and then decode the output by % jdatadecode; input file must have a suffix of .jdt % % all options for loadubjson/loadjson (depends on file suffix) % can be used to adjust the parsing options % % output: % varlist: a struct with each subfield a variable stored in the file, % if output is ignored, the variables will be loaded to the % workspace specified by the 'ws' option, which by default % load the variables to the current workspace ('caller') % % examples: % jload % load all variables in jamdata.jamm to the 'caller' workspace % jload mydat.jamm % jload('mydat.jamm','vars', {'v1','v2',...}) % load selected variables % varlist=jload('mydat.jamm','simplifycell',1) % % license: % BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details % % -- this function is part of JSONLab toolbox (http://openjdata.org/jsonlab) % if(nargin==0) filename=[pwd filesep 'jamdata.jamm']; end opt=varargin2struct(varargin{:}); ws=jsonopt('ws','caller',opt); loadfun=@loadbj; if(regexp(filename,'\.[jJ][sS][oO][nN]$')) loadfun=@loadjson; elseif(regexp(filename,'\.[jJ][dD][tT]$')) loadfun=@loadjson; elseif(regexp(filename,'\.[mM][sS][gG][pP][kK]$')) loadfun=@loadmsgpack; end if(jsonopt('matlab',0,opt) && exist('jsonencode','builtin')) jsonstr=fileread(filename); pos=regexp(jsonstr,'}\n\n\n{"WorkspaceData":','once'); if(isempty(pos)) error('the json file is not generated using matlab''s jsonencode'); end header=jsondecode(jsonstr(1:pos+1)); else header=loadfun(filename,'ObjectID',1, varargin{:}); end allvar=fieldnames(header.WorkspaceHeader); varlist=jsonopt('vars',allvar,opt); varlist(ismember(varlist,encodevarname('_DataInfo_')))=[]; isfound=ismember(varlist,allvar); if(any(isfound==0)) error('specified variable is not found'); end if(jsonopt('matlab',0,opt) && exist('jsonencode','builtin')) body=jdatadecode(jsondecode(jsonstr(pos+4:end))); else body=loadfun(filename,'ObjectID',2, varargin{:}); end if(nargout==0) for i=1:length(varlist) assignin(ws, varlist{i}, body.WorkspaceData.(varlist{i})); end else varargout{1}=rmfield(body.WorkspaceData,setdiff(fieldnames(body.WorkspaceData),varlist)); if(nargout>1) varargout{2}=header; end end |