Skip to content
Snippets Groups Projects
Commit 8fe81617 authored by MichelJuillard's avatar MichelJuillard
Browse files

fix compatibility with Octave v7.2

parent 5a8da364
Branches
Tags
No related merge requests found
......@@ -50,14 +50,16 @@ end
P = cellfun(@(c)[mdbnomics_src_root c], p, 'uni', false);
addpath(P{:});
% Check minimal MATLAB requirements.
if matlab_ver_less_than('8.5')
error('The minimum MATLAB requirement of this package is R2015a.');
end
if ~isoctave()
% Check minimal MATLAB requirements.
if matlab_ver_less_than('8.5')
error('The minimum MATLAB requirement of this package is R2015a.');
end
% Add jsonlab if MATLAB version < R2016b
if matlab_ver_less_than('9.1')
addpath([mdbnomics_src_root '/../contrib/jsonlab']);
% Add jsonlab if MATLAB version < R2016b
if matlab_ver_less_than('9.1')
addpath([mdbnomics_src_root '/../contrib/jsonlab']);
end
end
mdb_options.api_base_url = 'https://api.db.nomics.world';
......
......@@ -30,7 +30,7 @@ function response_json = fetch_series_page(series_endpoint_url, offset)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if contains(series_endpoint_url, '?')
if strfind(series_endpoint_url, '?')
series_page_url = sprintf('%s%soffset=%i', series_endpoint_url, '&', offset);
else
series_page_url = sprintf('%s%soffset=%i', series_endpoint_url, '?', offset);
......@@ -38,18 +38,18 @@ end
options = weboptions('ContentType','json');
try
response_json = webread(series_page_url, options);
if isoctave()
disp(webread(series_page_url, options))
response_json = jsondecode(webread(series_page_url, options));
else
response_json = webread(series_page_url, options);
end
catch ME
error_message = ['Could not fetch data from URL: ' series_page_url ' because: ' ME.identifier];
error(error_message);
end
if isempty(response_json.errors)
series_page = response_json.series;
if ~isempty(series_page)
assert(series_page.offset == offset);
end
else
if ~isempty(response_json.errors)
error_ = response_json.errors;
if ~isempty(error_.dataset_code) && isempty(error_.series_code)
error('%s for: %s. Please revise your input for dataset code.', error_.message, error_.dataset_code);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment