-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathsignup.m
More file actions
29 lines (28 loc) · 958 Bytes
/
signup.m
File metadata and controls
29 lines (28 loc) · 958 Bytes
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
function response = signup(username, email)
% SIGNUP(username, email) Remote signup to plot.ly and plot.ly API
% response = signup(username, email) makes an account on plotly and
% returns a temporary password and an api key
%
% See also plotly, plotlylayout, plotlystyle, signin
%
% For full documentation and examples, see https://plot.ly/api
platform = 'MATLAB';
payload = {'version', '0.2', 'un', username, 'email', email, ...
'platform', platform};
url = 'https://plot.ly/apimkacct';
resp = urlread(url, 'Post', payload);
response = jsondecode(resp);
f = fieldnames(response);
if any(strcmp(f, 'error'))
error(response.error)
end
if any(strcmp(f, 'warning'))
fprintf(response.warning)
end
if any(strcmp(f, 'message'))
fprintf(response.message)
end
if any(strcmp(f, 'filename'))
plotlysession(response.filename)
end
end