matlab连接API接口常用的几个函数分别为:weboptions、webread、webwrite;不同函数对应的解释分别可以查官网即可;
weboptions:https://ww2.mathworks.cn/help/matlab/ref/weboptions.html
webread:https://ww2.mathworks.cn/help/matlab/ref/webread.html
webwrite:https://ww2.mathworks.cn/help/matlab/ref/webwrite.html
这里就不做过多介绍了。
matlab连接起来也是比较方便的,
clc
clear
%登录
URL = '你自己的URL';
%对应的API查询结构体,不同接口不一样,根据实际情况来即可
body = struct(...
'op', 'all',...
'options', struct(...
'select', struct(...
'ObjectCode', 0,...
'CollectTime', 1,...
'InsertTime', 2,...
'PointValue1', 3,...
'PointValue2', 4,...
'PointValue3', 5,...
'PointValue4', 6,...
'PointValue5', 7,...
'PointValue6', 8,...
'PointValue7', 9,...
'PointValue8', 10,...
'PointValue9', 11,...
'PointValue10', 12 ...
), ...
'sort', {{
'CollectTime'
}},...
'limit', 10000 ...
)...
);
response = webwrite(URL,jsonData)