webread函数不适用于在Matlab 2016b中读取JSON

时间:2018-04-26 07:19:29

标签: json matlab web

我正在运行

>> webread(url)
Error using webread (line 116)
Too many input arguments.

url只是返回JSON的网址。

更新

>> webread('https://jsonplaceholder.typicode.com/users');
116 [url, postData, options] = encodeInputs(url, queryParams, options);
Error using webread (line 116)
Too many input arguments.

>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.1.0.441655 (R2016b)
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 16299)
Java Version: Java 1.8.0_111-b14 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.1         (R2016b)
....

更新2

功能内容:

function varargout = webread(url, varargin)
...
% Parse the inputs.
[queryParams, options] = parseInputs(mfilename, varargin);

% Encode inputs.
[url, postData, options] = encodeInputs(url, queryParams, options);

116行是最后一行。

路径为C:\Program Files\MATLAB\R2016b\toolbox\matlab\external\interfaces\webservices\restful\webread.m

更新3

跟踪显示根本原因在C:\Program Files\MATLAB\R2016b\toolbox\matlab\external\interfaces\webservices\http\+matlab\+net\URI.m的#427行中,其中包含:

obj.Path = strsplit(string(value), '/', 'CollapseDelimiters', false); 

K>> strsplit(string(value), '/', 'CollapseDelimiters', false)
Error using strsplit
Too many input arguments.

K>> value

value = 

  string

    "/users"

strsplit是我的功能,它会覆盖内置的一个!

0 个答案:

没有答案