|
1 | | -function jdata=jdencode(data, varargin) |
| 1 | +function jdata=jdataencode(data, varargin) |
2 | 2 | % |
3 | | -% jdata=jdencode(data) |
| 3 | +% jdata=jdataencode(data) |
4 | 4 | % or |
5 | | -% jdata=jdencode(data, options) |
6 | | -% jdata=jdencode(data, 'Param1',value1, 'Param2',value2,...) |
| 5 | +% jdata=jdataencode(data, options) |
| 6 | +% jdata=jdataencode(data, 'Param1',value1, 'Param2',value2,...) |
7 | 7 | % |
8 | 8 | % Serialize a MATLAB struct or cell array into a JData-compliant |
9 | 9 | % structure as defined in the JData spec: http://github.com/fangq/jdata |
|
19 | 19 | % total element count is larger than this number. |
20 | 20 | % |
21 | 21 | % example: |
22 | | -% jd=jdencode(struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5))) |
| 22 | +% jd=jdataencode(struct('a',rand(5)+1i*rand(5),'b',[],'c',sparse(5,5))) |
23 | 23 | % |
24 | 24 | % license: |
25 | 25 | % BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details |
|
29 | 29 |
|
30 | 30 |
|
31 | 31 | if(nargin==0) |
32 | | - help jdencode |
| 32 | + help jdataencode |
33 | 33 | return; |
34 | 34 | end |
35 | 35 |
|
|
95 | 95 |
|
96 | 96 | %%------------------------------------------------------------------------- |
97 | 97 | function newitem=mat2jd(item,varargin) |
98 | | -if(isa(item,'string') || ischar(item) || (isvector(item) && isreal(item) && ~issparse(item))) |
| 98 | +if(isempty(item) || isa(item,'string') || ischar(item) || (isvector(item) && isreal(item) && ~issparse(item))) |
99 | 99 | newitem=item; |
100 | 100 | return; |
101 | 101 | end |
|
0 commit comments