forked from plotly/plotly_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadplotlyconfig.m
More file actions
30 lines (23 loc) · 991 Bytes
/
loadplotlyconfig.m
File metadata and controls
30 lines (23 loc) · 991 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
30
function config = loadplotlyconfig()
userhome = getuserdir();
plotly_config_file = fullfile(userhome,'.plotly','.config');
% check if config exist
if ~exist(plotly_config_file, 'file')
error('Plotly:ConfigNotFound',...
['It looks like you haven''t set up your plotly '...
'account configuration file yet.\nTo get started, save your '...
'plotly/stream endpoint domain by calling:\n'...
'>>> saveplotlyconfig(plotly_domain, plotly_streaming_domain)\n\n'...
'For more help, see https://plot.ly/MATLAB or contact '...
'chris@plot.ly.']);
end
fileIDConfig = fopen(plotly_config_file, 'r');
if(fileIDConfig == -1)
error('plotly:loadconfig', ...
['There was an error reading your configuration file at '...
plotly_credentials_file '. Contact chris@plot.ly for support.']);
end
config_string_array = fread(fileIDConfig, '*char');
config_string = sprintf('%s',config_string_array);
config = loadjson(config_string);
end