-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathloadplotlyconfig.m
More file actions
28 lines (23 loc) · 1.09 KB
/
loadplotlyconfig.m
File metadata and controls
28 lines (23 loc) · 1.09 KB
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
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.\n' ...
'To get started, save your plotly/stream endpoint ' ...
'domain by calling:\n>>> saveplotlyconfig(' ...
'plotly_domain, plotly_streaming_domain)\n\nFor 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 = jsondecode(config_string);
end